Lines Matching defs:hash
52 #include "hash.h"
112 struct __xar_hash_t *hash = calloc(1, sizeof(struct __xar_hash_t));
113 if( ! hash )
117 HASH_CTX(hash)->context = context;
120 HASH_CTX(hash)->digest = digestRef_from_name(digest_name, &HASH_CTX(hash)->length);
123 HASH_CTX(hash)->type = EVP_get_digestbyname(digest_name);
124 EVP_DigestInit(&HASH_CTX(hash)->digest, HASH_CTX(hash)->type);
127 HASH_CTX(hash)->digest_name = strdup(digest_name);
129 return hash;
132 void *xar_hash_get_context(xar_hash_t hash) {
133 return HASH_CTX(hash)->context;
136 const char *xar_hash_get_digest_name(xar_hash_t hash) {
137 return HASH_CTX(hash)->digest_name;
140 void xar_hash_update(xar_hash_t hash, void *buffer, size_t nbyte) {
142 CCDigestUpdate(HASH_CTX(hash)->digest, buffer, nbyte);
144 EVP_DigestUpdate(&HASH_CTX(hash)->digest, buffer, nbyte);
148 void *xar_hash_finish(xar_hash_t hash, size_t *nbyte) {
158 CCDigestFinal(HASH_CTX(hash)->digest, buffer);
159 CCDigestDestroy(HASH_CTX(hash)->digest);
161 EVP_DigestFinal(&HASH_CTX(hash)->digest, buffer, &HASH_CTX(hash)->length);
164 *nbyte = HASH_CTX(hash)->length;
165 free((void *)HASH_CTX(hash)->digest_name);
166 free((void *)hash);
337 // Fetch the existing hash from the archive
345 // We have the fetched hash; now get the calculated hash
370 // Clean up the unarchived hash as well, if we have one
373 void *hash = xar_hash_finish(CONTEXT(context)->unarchived, &length);
374 free(hash);