if (u)
p += sizeof(const char *) - u;
sp->hashptr = (void*)p;
- if (params->hash_sha256)
- SHA256_Init(sp->wrk->sha256ctx);
+ SHA256_Init(sp->wrk->sha256ctx);
}
void
sp->hashptr[sp->ihashptr + 1] = str + l;
sp->ihashptr += 2;
sp->lhashptr += l + 1;
- if (params->hash_sha256) {
- SHA256_Update(sp->wrk->sha256ctx, str, l);
- SHA256_Update(sp->wrk->sha256ctx, "#", 1);
- }
+ SHA256_Update(sp->wrk->sha256ctx, str, l);
+ SHA256_Update(sp->wrk->sha256ctx, "#", 1);
}
struct object *
h = sp->http;
HSH_Prealloc(sp);
- if (params->hash_sha256) {
- SHA256_Final(sp->wrk->nobjhead->digest, sp->wrk->sha256ctx);
- /* WSP(sp, SLT_Debug, "SHA256: <%.32s>", sha256); */
- }
+ SHA256_Final(sp->wrk->nobjhead->digest, sp->wrk->sha256ctx);
if (sp->objhead != NULL) {
CHECK_OBJ_NOTNULL(sp->objhead, OBJHEAD_MAGIC);
struct objhead *oh;
struct hcl_hd *hp;
unsigned u1, digest;
- unsigned u, v;
int i;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC);
- digest = ~0U;
- for (u = 0; u < sp->ihashptr; u += 2) {
- v = pdiff(sp->hashptr[u], sp->hashptr[u + 1]);
- digest = crc32(digest, sp->hashptr[u], v);
- }
- digest ^= ~0U;
-
+ assert(sizeof noh->digest > sizeof digest);
+ memcpy(&digest, noh->digest, sizeof digest);
u1 = digest % hcl_nhash;
hp = &hcl_head[u1];
(void)oh;
AZ(pthread_create(&tp, NULL, hcb_cleaner, NULL));
- assert(params->hash_sha256);
assert(sizeof(struct hcb_y) <= sizeof(oh->u));
memset(&hcb_root, 0, sizeof hcb_root);
hcb_build_bittbl();
struct objhead *oh;
unsigned u;
- assert(params->hash_sha256);
oh = hcb_insert(&hcb_root, noh, 0);
if (oh != NULL) {
/* Assert that we didn't muck with the tree without lock */
/* Default grace period */
unsigned default_grace;
- /* Use sha256 hasing */
- unsigned hash_sha256;
-
/* Log hash string to shm */
unsigned log_hash;
"NB: Must be specified with -p to have effect.\n",
0,
"8192", "bytes" },
- { "hash_sha256", tweak_bool, &master.hash_sha256, 0, 0,
- "Use SHA256 compression of hash-strings",
- 0,
- "on", "bool" },
{ "log_hashstring", tweak_bool, &master.log_hash, 0, 0,
"Log the hash string to shared memory log.\n",
0,