MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sha1Hash

Function sha1Hash

app/redis-6.2.6/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 4

SHA1InitFunction · 0.50
SHA1UpdateFunction · 0.50
SHA1FinalFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected