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
| 124 | * will lead to a different digest compared to "fo", "obar". |
| 125 | */ |
| 126 | void mixDigest(unsigned char *digest, const void *ptr, size_t len) { |
| 127 | SHA1_CTX ctx; |
| 128 | const char *s = (const char*)ptr; |
| 129 | |
| 130 | xorDigest(digest,s,len); |
| 131 | SHA1Init(&ctx); |
| 132 | SHA1Update(&ctx,digest,20); |
| 133 | SHA1Final(digest,&ctx); |
| 134 | } |
| 135 | |
| 136 | void mixStringObjectDigest(unsigned char *digest, robj_roptr o) { |
| 137 | o = getDecodedObject(o); |
no test coverage detected