Converts a hexadecimal string (e.g. a MongoDB id) to a hashid.

        :param hex_str The hexadecimal string to encodes

        >>> Hashids.encode_hex('507f1f77bcf86cd799439011')
        'y42LW46J9luq3Xq9XMly'
162608
def encode_hex(self, hex_str):
        
        numbers = (int('1' + hex_str[i:i+12], 16)
                   for i in range(0, len(hex_str), 12))
        try:
            return self.encode(*numbers)
        except ValueError:
            return ''
186433
function(str) {
                str = blake32(str);
                var hash = 1315423911, i, ch;
                for (i = str.length - 1; i >= 0; i--) {
                    ch = str.charCodeAt(i);
                    hash ^= ((hash << 5) + ch + (hash >> 2));
                }
                return  (hash & 0x7FFFFFFF);
            }
1235466
def to_hex_string(grouping = false)
      ret = self.unpack('H*').first
      if grouping
        if grouping.is_a?(::Integer) && grouping > 0
          ret.gsub(/(#{'.' * grouping})/,'\1 ').rstrip
        else
          ret.gsub(/(..)/,'\1 ').rstrip
        end
      else
        ret
      end
    end
617741
function hex_string() {
    var ret = this.many1(this.seqf(this.stringf('.'), hexChar));
    return ret.map(function(el) { return el[2]; }).join('');
}
90833
def get_code_hash(code: str) -> str:
    
    code = code[2:] if code[:2] == "0x" else code
    try:
        keccak = sha3.keccak_256()
        keccak.update(bytes.fromhex(code))
        return "0x" + keccak.hexdigest()
    except ValueError:
        log.debug("Unable to change the bytecode to bytes. Bytecode: {}".format(code))
        return ""
1067836
def to_hex(
    primitive: Primitives = None, hexstr: HexStr = None, text: str = None
) -> HexStr:
    
    if hexstr is not None:
        return HexStr(add_0x_prefix(hexstr.lower()))

    if text is not None:
        return HexStr(encode_hex(text.encode("utf-8")))

    if is_boolean(primitive):
        return HexStr("0x1") if primitive else HexStr("0x0")

    if isinstance(primitive, (bytes, bytearray)):
        return HexStr(encode_hex(primitive))
    elif is_string(primitive):
        raise TypeError(
            "Unsupported type: The primitive argument must be one of: bytes,"
            "bytearray, int or bool and not str"
        )

    if is_integer(primitive):
        return HexStr(hex(cast(int, primitive)))

    raise TypeError(
        "Unsupported type: '{0}'.  Must be one of: bool, str, bytes, bytearray"
        "or int.".format(repr(type(primitive)))
    )
791345
def tohu_id(self):
        
        myhash = hashlib.md5(str(id(self)).encode()).hexdigest()
        return myhash[:12]
1092125
def hash_func(name):
    
    ret = 0
    for char in name:
        ret = ((ret << 5) + ret + ord(char)) & 0xffffffff
    return hex(ret)
874492
def hash(self, value):
        
        if is_iterable(value):
            value = tuple(to_bytestring(v) for v in value)
        return hashlib.md5(six.b(':').join(value)).hexdigest()
1061198
public static String hashSHA( String str ) {
        byte[] b = str.getBytes();
        MessageDigest md = null;
        try {
            md = MessageDigest.getInstance( "SHA1" );
            md.update( b );
        }
        catch ( NoSuchAlgorithmException e ) {
            e.printStackTrace();
            // it's got to be there
        }
        return toHexString( md.digest() );
    }
190555
public static String hash(final String str)
        {
        try
            {
            final MessageDigest md = new Sha1();
            final byte[] hashed = md.digest(str.getBytes("UTF-8"));
            final byte[] encoded = Base64.encodeBase64(hashed);
            return new String(encoded, "UTF-8");
            }
        catch (final UnsupportedEncodingException e)
            {
            LOG.error("Encoding error??", e);
            return "";
            }
        }
763665
function toHexString(arr) {
                var str = '';
                for (var i = 0; i < arr.length; i++) {
                    var obj = (arr[i] >>> 0).toString(16);
                    str += '00000000'.substr(obj.length) + obj;
                }
                return str;
            }
825218
def generate_hash_id(node):
    
    try:
        content = tostring(node)
    except Exception:
        logger.exception("Generating of hash failed")
        content = to_bytes(repr(node))

    hash_id = md5(content).hexdigest()
    return hash_id[:8]
1024559
def md5(value):
    
    m = hashlib.md5()
    m.update(value)
    return str(m.hexdigest())
436698
function(str) {
		if (str instanceof Uint8Array) return str;
		if (!is_hex(str)) {
      throw new TypeError("The provided string doesn't look like hex data");
    }
    var result = new Uint8Array(str.length / 2);
    for (var i = 0; i < str.length; i += 2) {
      result[i >>> 1] = parseInt(str.substr(i, 2), 16);
    }
    return result;
  }
1010569
def alphanumeric_hash(s: str, size=5):
  """"""
  import hashlib
  import base64
  hash_object = hashlib.md5(s.encode('ascii'))
  s = base64.b32encode(hash_object.digest())
  result = s[:size].decode('ascii').lower()
  return result
298184
def md5_string(s):
    
    m = hashlib.md5()
    m.update(s)
    return str(m.hexdigest())