Core FNV hash algorithm used in FNV0 and FNV1.
5682
def fnv(data, hval_init, fnv_prime, fnv_size):
    
    assert isinstance(data, bytes)

    hval = hval_init
    for byte in data:
        hval = (hval * fnv_prime) % fnv_size
        hval = hval ^ _get_byte(byte)
    return hval
811326
function generateHash( module, testName ) {
	var hex,
		i = 0,
		hash = 0,
		str = module + "\x1C" + testName,
		len = str.length;

	for ( ; i < len; i++ ) {
		hash  = ( ( hash << 5 ) - hash ) + str.charCodeAt( i );
		hash |= 0;
	}

	// Convert the possibly negative integer hash code into an 8 character hex string, which isn't
	// strictly necessary but increases user understanding that the id is a SHA-like hash
	hex = ( 0x100000000 + hash ).toString( 16 );
	if ( hex.length < 8 ) {
		hex = "0000000" + hex;
	}

	return hex.slice( -8 );
}
1276572
function facetAO(a00, a01, a02,
                 a10,      a12,
                 a20, a21, a22) {
  var s00 = (a00&OPAQUE_BIT) ? 1 : 0
    , s01 = (a01&OPAQUE_BIT) ? 1 : 0
    , s02 = (a02&OPAQUE_BIT) ? 1 : 0
    , s10 = (a10&OPAQUE_BIT) ? 1 : 0
    , s12 = (a12&OPAQUE_BIT) ? 1 : 0
    , s20 = (a20&OPAQUE_BIT) ? 1 : 0
    , s21 = (a21&OPAQUE_BIT) ? 1 : 0
    , s22 = (a22&OPAQUE_BIT) ? 1 : 0
  return (vertexAO(s10, s01, s00)<< AO_SHIFT) +
         (vertexAO(s01, s12, s02)<<(AO_SHIFT+AO_BITS)) +
         (vertexAO(s12, s21, s22)<<(AO_SHIFT+2*AO_BITS)) +
         (vertexAO(s21, s10, s20)<<(AO_SHIFT+3*AO_BITS))
}
612059
function P_hash(secret, seed, outputLength, algorithm) {
    let result = Buffer.alloc(0); // empty buffer
    let hmac;

    // for the initial iteration, set the (initial) data to our seed
    let data = seed;
    while (result.length < outputLength) {
        // calculate the hmac for our current 'data' value (our seed on the initiatial iteration...or an iterative hmac of that seed in later iterations)
        hmac = exports.crypto.createHmac(algorithm, secret).update(data).digest();
        // save this hmac result as the 'data' input for the next iteration
        let dataForNextIteration = hmac;
        // concatenate the hmac and our seed
        data = Buffer.concat([hmac, seed]);
        // calculate an hmac for the hmac-plus-seed (which we will store in our output)
        hmac = exports.crypto.createHmac(algorithm, secret).update(data).digest();
        // add the hmac to our result
        result = Buffer.concat([result, hmac]);
        // restore the saved first-interation-stage hmac as the 'data' input for our next iteration
        data = dataForNextIteration;
    }

    // if our HMAC's output block size resulted in a length which is slightly too big, discard the extra bytes.
    if (result.length > outputLength) {
        let truncatedBuffer = Buffer.alloc(outputLength);
        result.copy(truncatedBuffer, 0, 0, outputLength);
        result = truncatedBuffer;
    }

    // return the hash result (with the number of octects/bytes specified as 'outputLength' by the caller)
    return result;
}
729991
public static long mixHash(String str) {
		long hash = str.hashCode();
		hash <<= 32;
		hash |= fnvHash(str);
		return hash;
	}
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;
    }
1198527
private static int hash(long x, int length) {
        int h = (int)(x ^ (x >>> 32));
        // This function ensures that hashCodes that differ only by
        // constant multiples at each bit position have a bounded
        // number of collisions (approximately 8 at default load factor).
        h ^= (h >>> 20) ^ (h >>> 12);
        h ^= (h >>> 7) ^ (h >>> 4);
        return (h) & (length - 2);
    }
1108114
private int hash(GraphicsConfiguration config, int w, int h, Object... args) {
        int hash;

        hash = (config != null ? config.hashCode() : 0);
        hash = 31 * hash + w;
        hash = 31 * hash + h;
        hash = 31 * hash + Arrays.deepHashCode(args);

        return hash;
    }
223923
function Crypt_Hash($hash = 'sha1')
    {
        if ( !defined('CRYPT_HASH_MODE') ) {
            switch (true) {
                case extension_loaded('hash'):
                    define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH);
                    break;
                case extension_loaded('mhash'):
                    define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_MHASH);
                    break;
                default:
                    define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_INTERNAL);
            }
        }

        $this->setHash($hash);
    }
684173
private byte[] generateDeterministicHash(
			StreamNode node,
			Hasher hasher,
			Map<Integer, byte[]> hashes,
			boolean isChainingEnabled,
			StreamGraph streamGraph) {

		// Include stream node to hash. We use the current size of the computed
		// hashes as the ID. We cannot use the node's ID, because it is
		// assigned from a static counter. This will result in two identical
		// programs having different hashes.
		generateNodeLocalHash(hasher, hashes.size());

		// Include chained nodes to hash
		for (StreamEdge outEdge : node.getOutEdges()) {
			if (isChainable(outEdge, isChainingEnabled, streamGraph)) {

				// Use the hash size again, because the nodes are chained to
				// this node. This does not add a hash for the chained nodes.
				generateNodeLocalHash(hasher, hashes.size());
			}
		}

		byte[] hash = hasher.hash().asBytes();

		// Make sure that all input nodes have their hash set before entering
		// this loop (calling this method).
		for (StreamEdge inEdge : node.getInEdges()) {
			byte[] otherHash = hashes.get(inEdge.getSourceId());

			// Sanity check
			if (otherHash == null) {
				throw new IllegalStateException("Missing hash for input node "
						+ streamGraph.getSourceVertex(inEdge) + ". Cannot generate hash for "
						+ node + ".");
			}

			for (int j = 0; j < hash.length; j++) {
				hash[j] = (byte) (hash[j] * 37 ^ otherHash[j]);
			}
		}

		if (LOG.isDebugEnabled()) {
			String udfClassName = "";
			if (node.getOperator() instanceof AbstractUdfStreamOperator) {
				udfClassName = ((AbstractUdfStreamOperator<?, ?>) node.getOperator())
						.getUserFunction().getClass().getName();
			}

			LOG.debug("Generated hash '" + byteToHexString(hash) + "' for node " +
					"'" + node.toString() + "' {id: " + node.getId() + ", " +
					"parallelism: " + node.getParallelism() + ", " +
					"user function: " + udfClassName + "}");
		}

		return hash;
	}
551571
static void buildHashTable(Block keyBlock, int keyOffset, int keyCount, MethodHandle keyBlockHashCode, int[] outputHashTable, int hashTableOffset, int hashTableSize)
    {
        for (int i = 0; i < keyCount; i++) {
            int hash = getHashPosition(keyBlock, keyOffset + i, keyBlockHashCode, hashTableSize);
            while (true) {
                if (outputHashTable[hashTableOffset + hash] == -1) {
                    outputHashTable[hashTableOffset + hash] = i;
                    break;
                }
                hash++;
                if (hash == hashTableSize) {
                    hash = 0;
                }
            }
        }
    }
1025209
function customBase64Hash(str, hashFunction) {
  const result = hashFunction(str).toString(encBase64);
  return customBase64(result);
}
1200826
def _hash(x, elementType, relicHashFunc):
    
    # Combine all inputs into a single bytearray
    barray = bytearray()
    map(barray.extend, bytes(x))

    # Create an element of the correct type to hold the hash result
    result = elementType()

    # Convert barray into a modifiable ctypes buffer, hash using the provided
    # function, and return the result.
    buf = getBuffer(barray)
    relicHashFunc(byref(result), byref(buf), sizeof(buf))
    return result
438748
static Set<String> findModifiedParameters(Node fnNode) {
    ImmutableSet<String> names = getFunctionParameterSet(fnNode);
    Set<String> unsafeNames = new HashSet<>();
    return findModifiedParameters(fnNode.getLastChild(), names, unsafeNames, false);
  }
1107019
def signature_unsafe(m, sk, pk, hash_func=H):
    
    h = hash_func(sk)
    a = 2 ** (b - 2) + sum(2 ** i * bit(h, i) for i in range(3, b - 2))
    r = Hint(bytearray([h[j] for j in range(b // 8, b // 4)]) + m)
    R = scalarmult_B(r)
    S = (r + Hint(encodepoint(R) + pk + m) * a) % l
    return bytes(encodepoint(R) + encodeint(S))
810804
def produce_fake_hash(x):
    
    h = np.random.binomial(1, 0.5, (x.shape[0], 1024))
    packed = np.packbits(h, axis=-1).view(np.uint64)
    return zounds.ArrayWithUnits(
        packed, [x.dimensions[0], zounds.IdentityDimension()])
1098262
function computeHash(filename, algo, callback) {
    var crypto = require('crypto');
    var fs = require('fs');

    var chksum = crypto.createHash(algo);

    var s = fs.ReadStream(filename);
    s.on('error', function (err) {
        //no file, hash will be zero
        callback(0, err);
    });
    s.on('data', function (d) {
        chksum.update(d);
    });

    s.on('end', function () {
        var d = chksum.digest('hex');
        //util.debug(d + '  ' + filename);
        callback(d);
    });
}