]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/store_key_md5.cc
3 static cache_key null_key
[MD5_DIGEST_CHARS
];
6 storeKeyText(const unsigned char *key
)
8 static MemBuf mb
= MemBufNULL
;
11 for (i
= 0; i
< MD5_DIGEST_CHARS
; i
++)
12 memBufPrintf(&mb
, "%02X", *(key
+ i
));
17 storeKeyScan(const char *buf
)
19 static unsigned char digest
[MD5_DIGEST_CHARS
];
23 for (i
= 0; i
< MD5_DIGEST_CHARS
; i
++) {
24 t
[0] = *(buf
+ (j
++));
25 t
[1] = *(buf
+ (j
++));
27 *(digest
+ i
) = (unsigned char) strtol(t
, NULL
, 16);
33 storeKeyHashCmp(const void *a
, const void *b
)
35 const unsigned char *A
= a
;
36 const unsigned char *B
= b
;
38 for (i
= 0; i
< MD5_DIGEST_CHARS
; i
++) {
48 storeKeyHashHash(const void *key
, unsigned int n
)
50 /* note, n must be a power of 2! */
51 const unsigned char *digest
= key
;
52 unsigned int i
= digest
[0]
60 storeKeyPrivate(const char *url
, method_t method
, int num
)
62 static cache_key digest
[MD5_DIGEST_CHARS
];
65 char key_buf
[MAX_URL
+ 100];
67 debug(20, 3) ("storeKeyPrivate: %s %s\n",
68 RequestMethodStr
[method
], url
);
69 n
= snprintf(key_buf
, sizeof(key_buf
), "%d %s %s",
71 RequestMethodStr
[method
],
74 MD5Update(&M
, (unsigned char *) key_buf
, n
);
80 storeKeyPublic(const char *url
, method_t method
)
82 static cache_key digest
[MD5_DIGEST_CHARS
];
85 char key_buf
[MAX_URL
+ 100];
86 n
= snprintf(key_buf
, sizeof(key_buf
), "%s %s",
87 RequestMethodStr
[method
],
90 MD5Update(&M
, (unsigned char *) key_buf
, n
);
96 storeKeyDup(const cache_key
* key
)
98 cache_key
*dup
= xmalloc(MD5_DIGEST_CHARS
);
99 xmemcpy(dup
, key
, MD5_DIGEST_CHARS
);
100 /* XXX account key */
105 storeKeyFree(const cache_key
* key
)
108 /* XXX account key */
112 storeKeyHashBuckets(int nobj
)
124 storeKeyNull(const cache_key
* key
)
126 if (memcmp(key
, null_key
, MD5_DIGEST_CHARS
) == 0)
135 memset(null_key
, '\0', MD5_DIGEST_CHARS
);