]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/store_key_md5.cc
6 storeKeyText(const unsigned char *key
)
8 LOCAL_ARRAY(char, buf
, 33);
11 for (i
= 0; i
< MD5_DIGEST_CHARS
; i
++) {
13 snprintf(buf
+ o
, 33 - o
, "%02X", *(key
+ i
));
19 storeKeyScan(const char *buf
)
21 static unsigned char digest
[MD5_DIGEST_CHARS
];
25 for (i
=0; i
<MD5_DIGEST_CHARS
; i
++) {
29 *(digest
+i
) = (unsigned char) strtol(t
, NULL
, 16);
35 storeKeyHashCmp(const void *a
, const void *b
)
37 const unsigned char *A
= a
;
38 const unsigned char *B
= b
;
40 for (i
= 0; i
< MD5_DIGEST_CHARS
; i
++) {
50 storeKeyHashHash(const void *key
, unsigned int n
)
52 /* note, n must be a power of 2! */
53 const unsigned char *digest
= key
;
54 unsigned int i
= digest
[0]
62 storeKeyPrivate(const char *url
, method_t method
, int num
)
64 static cache_key digest
[MD5_DIGEST_CHARS
];
67 char key_buf
[MAX_URL
+ 100];
69 debug(20, 3) ("storeKeyPrivate: '%s'\n", url
);
70 n
= snprintf(key_buf
, MAX_URL
+ 100, "%d %s %s",
72 RequestMethodStr
[method
],
75 MD5Update(&M
, key_buf
, n
);
81 storeKeyPublic(const char *url
, method_t method
)
83 static cache_key digest
[MD5_DIGEST_CHARS
];
86 char key_buf
[MAX_URL
+ 100];
87 n
= snprintf(key_buf
, MAX_URL
+ 100, "%s %s",
88 RequestMethodStr
[method
],
91 MD5Update(&M
, key_buf
, n
);
97 storeKeyDup(const cache_key
* key
)
99 cache_key
*dup
= xmalloc(MD5_DIGEST_CHARS
);
100 xmemcpy(dup
, key
, MD5_DIGEST_CHARS
);
101 meta_data
.store_keys
+= MD5_DIGEST_CHARS
;
106 storeKeyFree(const cache_key
* key
)
109 meta_data
.store_keys
-= MD5_DIGEST_CHARS
;
113 storeKeyHashBuckets(int nobj
)
124 #endif /* STORE_KEY_MD5 */