/*
Compute an 8-byte hash of a byte array of length greater than 64 bytes.
355888
private static long hashLength65Plus(byte[] bytes, int offset, int length) {
        final int seed = 81;
        // For strings over 64 bytes we loop. Internal state consists of 56 bytes: v, w, x, y, and z.
        long x = seed;
        // @SuppressWarnings("ConstantOverflow")
        long y = seed * K1 + 113;
        long z = shiftMix(y * K2 + 113) * K2;
        long[] v = new long[2], w = new long[2];
        x = x * K2 + load64(bytes, offset);

        // Set end so that after the loop we have 1 to 64 bytes left to process.
        int end = offset + ((length - 1) / 64) * 64;
        int last64offset = end + ((length - 1) & 63) - 63;
        do {
            x = rotateRight(x + y + v[0] + load64(bytes, offset + 8), 37) * K1;
            y = rotateRight(y + v[1] + load64(bytes, offset + 48), 42) * K1;
            x ^= w[1];
            y += v[0] + load64(bytes, offset + 40);
            z = rotateRight(z + w[0], 33) * K1;
            weakHashLength32WithSeeds(bytes, offset, v[1] * K1, x + w[0], v);
            weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
            long tmp = x;
            x = z;
            z = tmp;
            offset += 64;
        } while (offset != end);
        long mul = K1 + ((z & 0xFF) << 1);
        // Operate on the last 64 bytes of input.
        offset = last64offset;
        w[0] += ((length - 1) & 63);
        v[0] += w[0];
        w[0] += v[0];
        x = rotateRight(x + y + v[0] + load64(bytes, offset + 8), 37) * mul;
        y = rotateRight(y + v[1] + load64(bytes, offset + 48), 42) * mul;
        x ^= w[1] * 9;
        y += v[0] * 9 + load64(bytes, offset + 40);
        z = rotateRight(z + w[0], 33) * mul;
        weakHashLength32WithSeeds(bytes, offset, v[1] * mul, x + w[0], v);
        weakHashLength32WithSeeds(bytes, offset + 32, z + w[1], y + load64(bytes, offset + 16), w);
        return hashLength16(hashLength16(v[0], w[0], mul) + shiftMix(y) * K0 + x, hashLength16(v[1], w[1], mul) + z, mul);
    }
1071687
static public long checksum2long(byte[] checksum, int offset, int length) {
    long crc = 0L;
    int iter = 0;
    for(int i=offset; i<offset+length; i++, iter++) {
      crc |= (0xffL&(long)checksum[i])<<((length-iter-1)*8);
    }
    return crc;
  }
1921
function(length) {
      var array, byte, _i, _len, _results;
      array = new Uint8Array(length);
      window.crypto.getRandomValues(array);
      _results = [];
      for (_i = 0, _len = array.length; _i < _len; _i++) {
        byte = array[_i];
        _results.push(byte);
      }
      return _results;
    }
436501
public static void hash(byte[] data, byte[] output) {
    int len = output.length;
    if (len == 0)
      return;
    int[] code = calculate(data);
    for (int outIndex = 0, codeIndex = 0, shift = 24;
            outIndex < len && codeIndex < 5;
                ++outIndex, shift -= 8) {
      output[outIndex] = (byte) (code[codeIndex] >>> shift);
      if (shift == 0) {
        shift = 32;     // will be decremented by 8 before next iteration
        ++codeIndex;
      }
    }
  }
887313
public long hash64( final byte[] data, int length, int seed) {
		final long m = 0xc6a4a7935bd1e995L;
		final int r = 47;

		long h = (seed&0xffffffffl)^(length*m);

		int length8 = length/8;

		for (int i=0; i<length8; i++) {
			final int i8 = i*8;
			long k =  ((long)data[i8+0]&0xff)      +(((long)data[i8+1]&0xff)<<8)
					+(((long)data[i8+2]&0xff)<<16) +(((long)data[i8+3]&0xff)<<24)
					+(((long)data[i8+4]&0xff)<<32) +(((long)data[i8+5]&0xff)<<40)
					+(((long)data[i8+6]&0xff)<<48) +(((long)data[i8+7]&0xff)<<56);

			k *= m;
			k ^= k >>> r;
					k *= m;

					h ^= k;
					h *= m; 
		}

		switch (length%8) {
		case 7: h ^= (long)(data[(length&~7)+6]&0xff) << 48;
		case 6: h ^= (long)(data[(length&~7)+5]&0xff) << 40;
		case 5: h ^= (long)(data[(length&~7)+4]&0xff) << 32;
		case 4: h ^= (long)(data[(length&~7)+3]&0xff) << 24;
		case 3: h ^= (long)(data[(length&~7)+2]&0xff) << 16;
		case 2: h ^= (long)(data[(length&~7)+1]&0xff) << 8;
		case 1: h ^= (long)(data[length&~7]&0xff);
		h *= m;
		};

		h ^= h >>> r;
		h *= m;
		h ^= h >>> r;

		return h;
	}
1044772
@Override
    public final long hash(byte[] buffer) {
        long hash = hash(buffer, 1);
        return (hash == HashFunction.NON_HASH_CODE) ? HashFunction.MAX_HASH_CODE : hash;
    }
621173
public static byte hashByteArray(byte[] array, int startInclusive, int endExclusive) {
        if (array == null) {
            return 0;
        }

        int range = endExclusive - startInclusive;
        if (range < 0) {
            throw new IllegalArgumentException(startInclusive + " > " + endExclusive);
        }

        int result = 1;
        for (int i=startInclusive; i<endExclusive; i++){
            result = 31 * result + array[i];
        }

        return (byte)result;
    }
766001
public static long[] hash(final long[] key, final long seed) {
    final HashState hashState = new HashState(seed, seed);
    final int longs = key.length; //in longs

    // Number of full 128-bit blocks of 2 longs (the body).
    // Possible exclusion of a remainder of 1 long.
    final int nblocks = longs >>> 1; //longs / 2

    // Process the 128-bit blocks (the body) into the hash
    for (int i = 0; i < nblocks; i++ ) {
      final long k1 = key[i << 1]; //0, 2, 4, ...
      final long k2 = key[(i << 1) + 1]; //1, 3, 5, ...
      hashState.blockMix128(k1, k2);
    }

    // Get the tail index, remainder length
    final int tail = nblocks << 1; // 2 longs / block
    final int rem = longs - tail; // remainder longs: 0,1

    // Get the tail
    final long k1 = (rem == 0) ? 0 : key[tail]; //k2 -> 0
    // Mix the tail into the hash and return
    return hashState.finalMix128(k1, 0, longs << 3); //convert to bytes
  }
200724
def long_hash(*buffers):
    
    hashed = hashlib.sha256()
    for buffer in buffers:
        hashed.update(buffer)
    return to_ascii(hashed.digest())[0:43]
285443
public static byte[] hash(InputStream in) throws IOException {
        if (HASH_DIGEST == null) {
            throw new EvernoteUtilException(EDAM_HASH_ALGORITHM + " not supported", new NoSuchAlgorithmException(EDAM_HASH_ALGORITHM));
        }

        byte[] buf = new byte[1024];
        int n;
        while ((n = in.read(buf)) != -1) {
            HASH_DIGEST.update(buf, 0, n);
        }
        return HASH_DIGEST.digest();
    }
898470
def _ComputeHash( key, seed = 0x0 ):
        
        def fmix( h ):
            h ^= h >> 16
            h  = ( h * 0x85ebca6b ) & 0xFFFFFFFF
            h ^= h >> 13
            h  = ( h * 0xc2b2ae35 ) & 0xFFFFFFFF
            h ^= h >> 16
            return h

        length = len( key )
        nblocks = int( length / 4 )

        h1 = seed

        c1 = 0xcc9e2d51
        c2 = 0x1b873593

        # body
        for block_start in xrange( 0, nblocks * 4, 4 ):
            k1 = key[ block_start + 3 ] << 24 | \
                 key[ block_start + 2 ] << 16 | \
                 key[ block_start + 1 ] <<  8 | \
                 key[ block_start + 0 ]
             
            k1 = c1 * k1 & 0xFFFFFFFF
            k1 = ( k1 << 15 | k1 >> 17 ) & 0xFFFFFFFF # inlined ROTL32
            k1 = ( c2 * k1 ) & 0xFFFFFFFF
        
            h1 ^= k1
            h1  = ( h1 << 13 | h1 >> 19 ) & 0xFFFFFFFF # inlined _ROTL32 
            h1  = ( h1 * 5 + 0xe6546b64 ) & 0xFFFFFFFF

        # tail
        tail_index = nblocks * 4
        k1 = 0
        tail_size = length & 3

        if tail_size >= 3:
            k1 ^= key[ tail_index + 2 ] << 16
        if tail_size >= 2:
            k1 ^= key[ tail_index + 1 ] << 8
        if tail_size >= 1:
            k1 ^= key[ tail_index + 0 ]
    
        if tail_size != 0:
            k1  = ( k1 * c1 ) & 0xFFFFFFFF
            k1  = ( k1 << 15 | k1 >> 17 ) & 0xFFFFFFFF # _ROTL32
            k1  = ( k1 * c2 ) & 0xFFFFFFFF
            h1 ^= k1

        return fmix( h1 ^ length )
892244
public static byte[] computeMD5Hash(byte[] input) {
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            return md.digest(input);
        } catch (NoSuchAlgorithmException e) {
            // should never get here
            throw new IllegalStateException(e);
        }
    }
1219798
public static long computeHash64(CharSequence cs) {
        long h = HSTART;
        final long hmult = HMULT;
        final long[] ht = byteTable;
        final int len = cs.length();
        for (int i = 0; i < len; i++) {
            char ch = cs.charAt(i);
            h = (h * hmult) ^ ht[ch & 0xff];
            h = (h * hmult) ^ ht[(ch >>> 8) & 0xff];
        }
        return h;
    }
613757
function int64_to_bytes(num) {
        var retval = []
        for (var i = 0; i < 8; i++) {
            retval.push(num & 0xFF)
            num = num >>> 8
        }
        return retval
    }
1289573
public static int hash(MemorySegment[] segments, int offset, int numBytes) {
		if (inFirstSegment(segments, offset, numBytes)) {
			return MurmurHashUtil.hashBytes(segments[0], offset, numBytes);
		} else {
			return hashMultiSeg(segments, offset, numBytes);
		}
	}
64458
def hash_bytes( key, seed = 0x0, x64arch = True ):
    '''  '''

    hash_128 = hash128( key, seed, x64arch )

    bytestring = ''

    for i in xrange(0, 16, 1):
        lsbyte = hash_128 & 0xFF
        bytestring = bytestring + str( chr( lsbyte ) )
        hash_128 = hash_128 >> 8

    return bytestring
586168
function(data, keysize) {
      var input, mode;
      if (keysize == null) {
        keysize = 512;
      }
      data = this.toHex(data);
      mode = "SHA-" + keysize;
      input = new jsSHA(data, "HEX");
      return input.getHash(mode, "HEX");
    }