MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / sha1Hash

Function sha1Hash

utils/tracking_collisions.c:38–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38uint64_t sha1Hash(char *key, size_t len) {
39 SHA1_CTX ctx;
40 unsigned char hash[20];
41
42 SHA1Init(&ctx);
43 SHA1Update(&ctx,(unsigned char*)key,len);
44 SHA1Final(hash,&ctx);
45 uint64_t hash64;
46 memcpy(&hash64,hash,sizeof(hash64));
47 return hash64;
48}
49
50/* Test the hashing function provided as callback and return the
51 * number of collisions found. */

Callers

nothing calls this directly

Calls 3

SHA1InitFunction · 0.85
SHA1UpdateFunction · 0.85
SHA1FinalFunction · 0.85

Tested by

no test coverage detected