Lines Matching defs:hash
5 #include "hash-method.h"
13 int pkcs5_pbkdf1(const struct hash_method *hash,
20 length > hash->digest_size) return -1;
23 unsigned char dk[hash->digest_size];
24 unsigned char ctx[hash->context_size];
26 hash->init(ctx);
27 hash->loop(ctx, password, password_len);
28 hash->loop(ctx, salt, salt_len);
29 hash->result(ctx, dk);
33 hash->init(ctx);
34 hash->loop(ctx, dk, hash->digest_size);
35 hash->result(ctx, dk);
38 buffer_append(result, dk, hash->digest_size);
44 int pkcs5_pbkdf2(const struct hash_method *hash,
52 size_t l = (length + hash->digest_size - 1)/hash->digest_size; /* same as ceil(length/hash->digest_size) */
53 unsigned char dk[l * hash->digest_size];
57 unsigned char U_c[hash->digest_size];
60 block = &(dk[t*hash->digest_size]);
63 hmac_init(&hctx, password, password_len, hash);
68 memcpy(block, U_c, hash->digest_size);
71 hmac_init(&hctx, password, password_len, hash);
72 hmac_update(&hctx, U_c, hash->digest_size);
74 for(i = 0; i < hash->digest_size; i++)
84 int pkcs5_pbkdf(enum pkcs5_pbkdf_mode mode, const struct hash_method *hash,
91 return pkcs5_pbkdf1(hash,password,password_len,
94 return pkcs5_pbkdf2(hash,password,password_len,