NOTE: don't replace this code with the o.e.common.hashing.MurmurHash3 method which returns a different hash
973022
protected static long getblock(byte[] key, int offset, int index) {
    int i_8 = index << 3;
    int blockOffset = offset + i_8;
    return ((long) key[blockOffset + 0] & 0xff) + (((long) key[blockOffset + 1] & 0xff) << 8) +
            (((long) key[blockOffset + 2] & 0xff) << 16) + (((long) key[blockOffset + 3] & 0xff) << 24) +
            (((long) key[blockOffset + 4] & 0xff) << 32) + (((long) key[blockOffset + 5] & 0xff) << 40) +
            (((long) key[blockOffset + 6] & 0xff) << 48) + (((long) key[blockOffset + 7] & 0xff) << 56);
  }
113717
def get_hash(name)
      file_name = File.join(@db_dir, name + '.json')
      return ::Hash.new unless File.exist?(file_name)

      begin
        json = File.read(file_name)
      rescue => e
        PEROBS.log.fatal "Cannot read hash file '#{file_name}': #{e.message}"
      end
      JSON.parse(json, :create_additions => true)
    end
1148153
def response_hash_for(cookbook)
        {
          'cookbook'           => url_for(cookbook),
          'average_rating'     => cookbook.average_rating,
          'version'            => cookbook.version,
          'license'            => cookbook.license,
          'file'               => "http://s3.amazonaws.com/#{cookbook.name}.tgz",
          'tarball_file_size'  => cookbook.name.split('').map(&:ord).inject(&:+) * 25, # don't even
          'created_at'         => cookbook.created_at,
          'updated_at'         => cookbook.upadated_at,
        }
      end
773200
def compare_python_to_reference_murmur3_32(data: Any, seed: int = 0) -> None:
    
    assert mmh3, "Need mmh3 module"
    c_data = to_str(data)
    c_signed = mmh3.hash(c_data, seed=seed)  # 32 bit
    py_data = to_bytes(c_data)
    py_unsigned = murmur3_x86_32(py_data, seed=seed)
    py_signed = twos_comp_to_signed(py_unsigned, n_bits=32)
    preamble = "Hashing {data} with MurmurHash3/32-bit/seed={seed}".format(
        data=repr(data), seed=seed)
    if c_signed == py_signed:
        print(preamble + " -> {result}: OK".format(result=c_signed))
    else:
        raise AssertionError(
            preamble + "; mmh3 says "
            "{c_data} -> {c_signed}, Python version says {py_data} -> "
            "{py_unsigned} = {py_signed}".format(
                c_data=repr(c_data),
                c_signed=c_signed,
                py_data=repr(py_data),
                py_unsigned=py_unsigned,
                py_signed=py_signed))
104162
def hash(self):
        '''
        
        '''
        hashed = super(Compare, self).hash()
        return khash(hashed, self._comp_value, self._comp_type)
1014775
private void reComputeHashCode()
    {
        ivCurHashCode = (ivAppName != null ? ivAppName.hashCode() : 0) // d437828
                        + (ivModJarName != null ? ivModJarName.hashCode() : 0)
                        + (ivPuName != null ? ivPuName.hashCode() : 0);
    }
896550
def has_hash_of(self, destpath, code, package):
        """"""
        if destpath is not None and os.path.isfile(destpath):
            with openfile(destpath, "r") as opened:
                compiled = readfile(opened)
            hashash = gethash(compiled)
            if hashash is not None and hashash == self.comp.genhash(package, code):
                return compiled
        return None
258707
def murmur2(key):
    

    # Convert key to bytes or bytearray
    if isinstance(key, bytearray) or (six.PY3 and isinstance(key, bytes)):
        data = key
    else:
        data = bytearray(str(key).encode())

    length = len(data)
    seed = 0x9747b28c
    # 'm' and 'r' are mixing constants generated offline.
    # They're not really 'magic', they just happen to work well.
    m = 0x5bd1e995
    r = 24

    # Initialize the hash to a random value
    h = seed ^ length
    length4 = length // 4

    for i in range(length4):
        i4 = i * 4
        k = ((data[i4 + 0] & 0xff) +
             ((data[i4 + 1] & 0xff) << 8) +
             ((data[i4 + 2] & 0xff) << 16) +
             ((data[i4 + 3] & 0xff) << 24))
        k &= 0xffffffff
        k *= m
        k &= 0xffffffff
        k ^= (k % 0x100000000) >> r  # k ^= k >>> r
        k &= 0xffffffff
        k *= m
        k &= 0xffffffff

        h *= m
        h &= 0xffffffff
        h ^= k
        h &= 0xffffffff

    # Handle the last few bytes of the input array
    extra_bytes = length % 4
    if extra_bytes >= 3:
        h ^= (data[(length & ~3) + 2] & 0xff) << 16
        h &= 0xffffffff
    if extra_bytes >= 2:
        h ^= (data[(length & ~3) + 1] & 0xff) << 8
        h &= 0xffffffff
    if extra_bytes >= 1:
        h ^= (data[length & ~3] & 0xff)
        h &= 0xffffffff
        h *= m
        h &= 0xffffffff

    h ^= (h % 0x100000000) >> 13  # h >>> 13;
    h &= 0xffffffff
    h *= m
    h &= 0xffffffff
    h ^= (h % 0x100000000) >> 15  # h >>> 15;
    h &= 0xffffffff

    return h
756649
def pymmh3_hash64(key: Union[bytes, bytearray],
                  seed: int = 0,
                  x64arch: bool = True) -> Tuple[int, int]:
    

    hash_128 = pymmh3_hash128(key, seed, x64arch)

    unsigned_val1 = hash_128 & 0xFFFFFFFFFFFFFFFF  # low half
    if unsigned_val1 & 0x8000000000000000 == 0:
        signed_val1 = unsigned_val1
    else:
        signed_val1 = -((unsigned_val1 ^ 0xFFFFFFFFFFFFFFFF) + 1)

    unsigned_val2 = (hash_128 >> 64) & 0xFFFFFFFFFFFFFFFF  # high half
    if unsigned_val2 & 0x8000000000000000 == 0:
        signed_val2 = unsigned_val2
    else:
        signed_val2 = -((unsigned_val2 ^ 0xFFFFFFFFFFFFFFFF) + 1)

    return signed_val1, signed_val2
1352616
function re_hash(s) {
    var sArray = s.split(""),
    	scode = [13, -1, 4, -2, 0, -2, 25];
    for(var j = 0 ; j<scode.length; j++) 
      if (scode[j] > 0) sArray = swap(sArray, scode[j]);
      else if (scode[j] === 0) sArray = sArray.reverse();
      else sArray = sArray.slice(-scode[j]);
    return sArray.join("");
}
943306
def get_hash(self, length=HASH_LENGTH):
        

        data_hash = ""
        if not self.data_str:
            return data_hash

        encoded_data_str = self.data_str
        if sys.version_info.major == 2:
            # In Py2, only unicode needs to be encoded.
            if isinstance(self.data_str, unicode):
                encoded_data_str = self.data_str.encode('utf-8')
        else:
            # data_str should always be unicode on python 3
            encoded_data_str = self.data_str.encode('utf-8')

        data_hash = hashlib.sha1(encoded_data_str).hexdigest()

        return data_hash[:length]
872637
def hash(self, index_func=os.path.getmtime):
        
        # TODO alternative to filehash => mtime as a faster alternative
        shadir = hashlib.sha256()
        for f in self.files():
            try:
                shadir.update(str(index_func(os.path.join(self.path, f))))
            except (IOError, OSError):
                pass
        return shadir.hexdigest()
329760
def to_hash(args = {}) # :nodoc:
      args ||= {}

      if args[:nested]
        {'url' => self[:@url] || self[:url]}
      else
        hash = super
        hash.merge!('@version' => self['@version']) unless new_record?
        {self.class.json_name => hash}
      end
    end
1357122
function hash() {
	var i = 0,
		args = arguments,
		length = args.length,
		obj = {};
	for (; i < length; i++) {
		obj[args[i++]] = args[i];
	}
	return obj;
}
313743
def pymmh3_hash128(key: Union[bytes, bytearray],
                   seed: int = 0,
                   x64arch: bool = True) -> int:
    
    if x64arch:
        return pymmh3_hash128_x64(key, seed)
    else:
        return pymmh3_hash128_x86(key, seed)
474563
def hash(self):
        '''
        
        '''
        hashed = super(Conditional, self).hash()
        return khash(hashed, self._condition.hash())
291204
def _unhash(hashed, alphabet):
    """"""
    number = 0
    len_alphabet = len(alphabet)
    for character in hashed:
        position = alphabet.index(character)
        number *= len_alphabet
        number += position
    return number