Restore a tuple of numbers from the passed `hashid`.

        :param hashid The hashid to decode

        >>> hashids = Hashids('arbitrary salt', 16, 'abcdefghijkl0123456')
        >>> hashids.decode('1d6216i30h53elk3')
        (1, 23, 456)
542613
def decode(self, hashid):
        
        if not hashid or not _is_str(hashid):
            return ()
        try:
            numbers = tuple(_decode(hashid, self._salt, self._alphabet,
                                    self._separators, self._guards))

            return numbers if hashid == self.encode(*numbers) else ()
        except ValueError:
            return ()
887765
def tuples2ids(tuples, ids):
    """"""
    for value in tuples:
        if value[0] == 6 and value[2]:
            ids = value[2]
        elif value[0] == 5:
            ids[:] = []
        elif value[0] == 4 and value[1] and value[1] not in ids:
            ids.append(value[1])
        elif value[0] == 3 and value[1] and value[1] in ids:
            ids.remove(value[1])
    return ids
996364
def split_stable_id(stable_id):
    
    split1 = stable_id.split("::")
    if len(split1) == 2:
        split2 = split1[1].split(":")
        if len(split2) == 3:
            return split1[0], split2[0], int(split2[1]), int(split2[2])
    raise ValueError(f"Malformed stable_id:\t{stable_id}")
490242
def decode_from_sha(sha):
    """"""
    if isinstance(sha, str):
        sha = sha.encode('utf-8')
    return codecs.decode(re.sub(rb'(00)*$', b'', sha), "hex_codec")
38491
def decode_keys(self, keys):
        
        return dict(((k, self.decode(v)) for k, v in six.iteritems(keys)))
64951
def _convert_hashes(values):
    
    hashes = {}
    if not values:
        return hashes
    for value in values:
        try:
            name, value = value.split(":", 1)
        except ValueError:
            name = "sha256"
        if name not in hashes:
            hashes[name] = []
        hashes[name].append(value)
    return hashes
295392
def clean_decodes(ids, vocab_size, eos_id=1):
  
  ret = []
  for i in ids:
    if i == eos_id:
      break
    if i >= vocab_size:
      break
    ret.append(int(i))
  return ret
197493
def get_subhash(hash):
    
    idx = [0xe, 0x3, 0x6, 0x8, 0x2]
    mul = [2, 2, 5, 4, 3]
    add = [0, 0xd, 0x10, 0xb, 0x5]

    b = []
    for i in range(len(idx)):
        a = add[i]
        m = mul[i]
        i = idx[i]
        t = a + int(hash[i], 16)
        v = int(hash[t:t + 2], 16)
        b.append(('%x' % (v * m))[-1])

    return ''.join(b)
487015
def decode_wireformat_uuid(rawguid):
    
    if isinstance(rawguid, list):
        rawguid = bytearray(rawguid)
    lebytes = struct.unpack_from('<IHH', buffer(rawguid[:8]))
    bebytes = struct.unpack_from('>HHI', buffer(rawguid[8:]))
    return '{0:08X}-{1:04X}-{2:04X}-{3:04X}-{4:04X}{5:08X}'.format(
        lebytes[0], lebytes[1], lebytes[2], bebytes[0], bebytes[1], bebytes[2])
648404
public function decodeId($string = '')
    {
        if (empty($string)) {
            return NULL;
        }
        try {
            $hash   = new Hashids($this->hashIds['salt'], $this->hashIds['minHashLength'], $this->hashIds['alphabet']);
            $decode = $hash->decode($string);
            if (count($decode) > 1) {
                return $decode;
            }

            return $decode[0];
        }
        catch (\Exception $e) {
            if (function_exists('log_message')) {
                $message = 'Error Code: ' . $e->getCode() . ' - File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Message: ' . $e->getMessage();
                log_message('error', $message);
            }

            return NULL;
        }
    }
66042
def hash_from_stream(n, hash_stream):
    
    _to_int64 = to_int64
    x = 0x345678
    multiplied = _to_int64(1000003)
    for n in range(n - 1, -1, -1):
        h = next(hash_stream)
        x = _to_int64((x ^ h) * multiplied)
        multiplied += _to_int64(82520 + _to_int64(2 * n))
        multiplied = _to_int64(multiplied)

    x += 97531
    x = _to_int64(x)
    if x == -1:
        return -2

    return x
1060202
function Id (_id) {
  var dec
  var hex

  if (typeof _id === 'number') {
    dec = _id
    var tmp = ('00000000000000' + _id.toString(16))
    hex = tmp.substring(tmp.length - 12, tmp.length)
  }
  if (typeof _id === 'string') {
    dec = parseInt(_id, 16)
    hex = _id
  }
  if (typeof _id === 'undefined') {
    hex = sha1((~~(Math.random() * 1e9)).toString(36) + Date.now())
      .substring(0, 12)
    dec = parseInt(hex, 16)
  }

  this.toHex = function () {
    return hex
  }

  this.toDec = function () {
    return dec
  }

  this.next = function () {
    if (hex === maxHex) {
      return '000000000000'
    } else {
      var a = ('000000000000' + ((dec + 1).toString(16)))
      return a.substring(a.length - 12, a.length)
    }
  }

  return this
}
1084211
private static String hashQuads(String id, Map<String, Object> bnodes, UniqueNamer namer) {
        // return cached hash
        if (((Map<String, Object>) bnodes.get(id)).containsKey("hash")) {
            return (String) ((Map<String, Object>) bnodes.get(id)).get("hash");
        }

        // serialize all of bnode's quads
        final List<Map<String, Object>> quads = (List<Map<String, Object>>) ((Map<String, Object>) bnodes
                .get(id)).get("quads");
        final List<String> nquads = new ArrayList<String>();
        for (int i = 0; i < quads.size(); ++i) {
            nquads.add(toNQuad((RDFDataset.Quad) quads.get(i),
                    quads.get(i).get("name") != null
                            ? (String) ((Map<String, Object>) quads.get(i).get("name")).get("value")
                            : null,
                    id));
        }
        // sort serialized quads
        Collections.sort(nquads);
        // return hashed quads
        final String hash = sha1hash(nquads);
        ((Map<String, Object>) bnodes.get(id)).put("hash", hash);
        return hash;
    }
131412
def ulid_to_binary(ulid):
    
    if isinstance(ulid, uuid.UUID):
        return ulid.bytes
    if isinstance(ulid, (text_type, bytes)) and len(ulid) == 26:
        return decode_ulid_base32(ulid)
    if isinstance(ulid, (bytes, bytearray)) and len(ulid) == 16:
        return ulid
    raise InvalidULID('can not convert ulid %r to binary' % ulid)
1334074
def _read_id_numbers(self):
        """"""
        _byte = self._read_fileng(4)
        _addr = '.'.join([str(_) for _ in _byte])
        return _addr
238185
def decode_dict(data, encoding=None, errors='strict', keep=False,
                normalize=False, preserve_dict_class=False,
                preserve_tuples=False, to_str=False):
    '''
    
    '''
    _decode_func = salt.utils.stringutils.to_unicode \
        if not to_str \
        else salt.utils.stringutils.to_str
    # Make sure we preserve OrderedDicts
    rv = data.__class__() if preserve_dict_class else {}
    for key, value in six.iteritems(data):
        if isinstance(key, tuple):
            key = decode_tuple(key, encoding, errors, keep, normalize,
                               preserve_dict_class, to_str) \
                if preserve_tuples \
                else decode_list(key, encoding, errors, keep, normalize,
                                 preserve_dict_class, preserve_tuples, to_str)
        else:
            try:
                key = _decode_func(key, encoding, errors, normalize)
            except TypeError:
                # to_unicode raises a TypeError when input is not a
                # string/bytestring/bytearray. This is expected and simply
                # means we are going to leave the value as-is.
                pass
            except UnicodeDecodeError:
                if not keep:
                    raise

        if isinstance(value, list):
            value = decode_list(value, encoding, errors, keep, normalize,
                                preserve_dict_class, preserve_tuples, to_str)
        elif isinstance(value, tuple):
            value = decode_tuple(value, encoding, errors, keep, normalize,
                                 preserve_dict_class, to_str) \
                if preserve_tuples \
                else decode_list(value, encoding, errors, keep, normalize,
                                 preserve_dict_class, preserve_tuples, to_str)
        elif isinstance(value, Mapping):
            value = decode_dict(value, encoding, errors, keep, normalize,
                                preserve_dict_class, preserve_tuples, to_str)
        else:
            try:
                value = _decode_func(value, encoding, errors, normalize)
            except TypeError:
                # to_unicode raises a TypeError when input is not a
                # string/bytestring/bytearray. This is expected and simply
                # means we are going to leave the value as-is.
                pass
            except UnicodeDecodeError:
                if not keep:
                    raise

        rv[key] = value
    return rv
861615
def decode_setid(encoded):
    """"""
    try:
        lo, hi = struct.unpack('<QQ', b32decode(encoded.upper() + '======'))
    except struct.error:
        raise ValueError('Cannot decode {!r}'.format(encoded))
    return (hi << 64) + lo