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

Function mixDigest

app/redis-6.2.6/src/debug.c:112–120  ·  view source on GitHub ↗

This function instead of just computing the SHA1 and xoring it * against digest, also perform the digest of "digest" itself and * replace the old value with the new one. * * So the final digest will be: * * digest = SHA1(digest xor SHA1(data)) * * This function is used every time we want to preserve the order so * that digest(a,b,c,d) will be different than digest(b,c,d,a) * * Also note

Source from the content-addressed store, hash-verified

110 * will lead to a different digest compared to "fo", "obar".
111 */
112void mixDigest(unsigned char *digest, void *ptr, size_t len) {
113 SHA1_CTX ctx;
114 char *s = ptr;
115
116 xorDigest(digest,s,len);
117 SHA1Init(&ctx);
118 SHA1Update(&ctx,digest,20);
119 SHA1Final(digest,&ctx);
120}
121
122void mixStringObjectDigest(unsigned char *digest, robj *o) {
123 o = getDecodedObject(o);

Callers 5

mixStringObjectDigestFunction · 0.85
xorObjectDigestFunction · 0.85
computeDatasetDigestFunction · 0.85
RM_DigestAddStringBufferFunction · 0.85
RM_DigestAddLongLongFunction · 0.85

Calls 4

xorDigestFunction · 0.85
SHA1InitFunction · 0.70
SHA1UpdateFunction · 0.70
SHA1FinalFunction · 0.70

Tested by

no test coverage detected