6 unsigned char buf[128];
14 unsigned char buf[64];
22 unsigned char buf[64];
30 unsigned char buf[64];
38 unsigned char buf[64];
46 unsigned char buf[64];
52 unsigned char chksum[16],
X[48], buf[16];
60 unsigned char buf[64];
68 unsigned char buf[64];
76 unsigned char buf[64];
84 unsigned char buf[64];
90 struct whirlpool_state {
92 unsigned char buf[64];
107 struct chc_state chc;
110 struct whirlpool_state whirlpool;
113 struct sha512_state sha512;
116 struct sha256_state sha256;
119 struct sha1_state sha1;
122 struct md5_state md5;
125 struct md4_state md4;
128 struct md2_state md2;
131 struct tiger_state tiger;
134 struct rmd128_state rmd128;
137 struct rmd160_state rmd160;
140 struct rmd256_state rmd256;
143 struct rmd320_state rmd320;
187 int (*
hmac_block)(
const unsigned char *key,
unsigned long keylen,
188 const unsigned char *in,
unsigned long inlen,
189 unsigned char *out,
unsigned long *outlen);
194 int chc_register(
int cipher);
196 int chc_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
204 int whirlpool_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
206 int whirlpool_test(
void);
212 int sha512_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
214 int sha512_test(
void);
220 #error LTC_SHA512 is required for LTC_SHA384
223 #define sha384_process sha512_process
225 int sha384_test(
void);
231 int sha256_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
233 int sha256_test(
void);
238 #error LTC_SHA256 is required for LTC_SHA224
241 #define sha224_process sha256_process
243 int sha224_test(
void);
250 int sha1_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
266 int md4_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
274 int md2_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
282 int tiger_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
284 int tiger_test(
void);
290 int rmd128_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
292 int rmd128_test(
void);
298 int rmd160_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
300 int rmd160_test(
void);
306 int rmd256_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
308 int rmd256_test(
void);
314 int rmd320_process(
hash_state * md,
const unsigned char *in,
unsigned long inlen);
316 int rmd320_test(
void);
332 const unsigned char *in,
unsigned long inlen,
333 unsigned char *out,
unsigned long *outlen);
335 const unsigned char *in,
unsigned long inlen, ...);
336 int hash_filehandle(
int hash, FILE *in,
unsigned char *out,
unsigned long *outlen);
337 int hash_file(
int hash,
const char *fname,
unsigned char *out,
unsigned long *outlen);
340 #define HASH_PROCESS(func_name, compress_name, state_var, block_size) \
341 int func_name (hash_state * md, const unsigned char *in, unsigned long inlen) \
345 LTC_ARGCHK(md != NULL); \
346 LTC_ARGCHK(in != NULL); \
347 if (md-> state_var .curlen > sizeof(md-> state_var .buf)) { \
348 return CRYPT_INVALID_ARG; \
350 while (inlen > 0) { \
351 if (md-> state_var .curlen == 0 && inlen >= block_size) { \
352 if ((err = compress_name (md, (unsigned char *)in)) != CRYPT_OK) { \
355 md-> state_var .length += block_size * 8; \
357 inlen -= block_size; \
359 n = MIN(inlen, (block_size - md-> state_var .curlen)); \
360 memcpy(md-> state_var .buf + md-> state_var.curlen, in, (size_t)n); \
361 md-> state_var .curlen += n; \
364 if (md-> state_var .curlen == block_size) { \
365 if ((err = compress_name (md, md-> state_var .buf)) != CRYPT_OK) { \
368 md-> state_var .length += 8*block_size; \
369 md-> state_var .curlen = 0; \
struct ltc_hash_descriptor hash_descriptor[]
static void md5_process(md5_state_t *pms, const md5_byte_t *data)
Definition: Crypto_md5.cpp:220
int hash_memory(int hash, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
int find_hash(const char *name)
#define hash
Definition: private_namespace.h:186
#define LTC_MUTEX_PROTO(x)
Definition: tomcrypt_custom.h:405
int find_hash_oid(const unsigned long *ID, unsigned long IDlen)
#define MAXBLOCKSIZE
Definition: tomcrypt.h:23
#define X
Definition: CollisionDetection.cpp:2281
unsigned char ID
Definition: tomcrypt_hash.h:153
int hash_is_valid(int idx)
int(* test)(void)
Definition: tomcrypt_hash.h:184
int(* hmac_block)(const unsigned char *key, unsigned long keylen, const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen)
Definition: tomcrypt_hash.h:187
unsigned long ulong32
Definition: tomcrypt_macros.h:16
unsigned long long ulong64
Definition: tomcrypt_macros.h:7
static void md5_init(md5_state_t *pms)
Definition: Crypto_md5.cpp:401
int(* process)(hash_state *hash, const unsigned char *in, unsigned long inlen)
Definition: tomcrypt_hash.h:174
Definition: tomcrypt_hash.h:149
unsigned long OIDlen
Definition: tomcrypt_hash.h:161
int unregister_hash(const struct ltc_hash_descriptor *hash)
Definition: tomcrypt_hash.h:105
unsigned long OID[16]
Definition: tomcrypt_hash.h:159
float length(float v)
Definition: vectorMath.h:208
unsigned long hashsize
Definition: tomcrypt_hash.h:155
int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen)
union Hash_state hash_state
unsigned long blocksize
Definition: tomcrypt_hash.h:157
int(* done)(hash_state *hash, unsigned char *out)
Definition: tomcrypt_hash.h:180
char * name
Definition: tomcrypt_hash.h:151
int find_hash_any(const char *name, int digestlen)
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen, const unsigned char *in, unsigned long inlen,...)
int register_hash(const struct ltc_hash_descriptor *hash)
#define const
Definition: zconf.h:217
int(* init)(hash_state *hash)
Definition: tomcrypt_hash.h:167
void * data
Definition: tomcrypt_hash.h:145
int find_hash_id(unsigned char ID)
int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen)