forked from greg42/truecrypt4bsd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hash.h
48 lines (40 loc) · 1.23 KB
/
hash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return Gregor Kopf
* ----------------------------------------------------------------------------
*/
#ifndef _HASH_H
#define _HASH_H
#include "common.h"
#define HASH_MAX 4
#define HASH_RIPEMD_160 0
#define HASH_SHA1 1
#define HASH_SHA512 2
#define HASH_WHIRLPOOL 3
#define HASH_INSECURE_CRC32 4
#include "rmd160.h"
#include "sha1.h"
#include "sha2.h"
#include "whirlpool.h"
typedef union h_internalContextUnion {
rmd160_ctx rmd;
SHA1Context sha1;
sha512_ctx sha512;
NESSIEstruct whirlpool;
uint32_t crc32;
} h_internalContextUnion;
typedef struct hash_ctx {
uint blocksize;
uint type;
uint outsize;
h_internalContextUnion internalContext;
} hash_ctx;
#include "hash_api.h"
int hash_init(hash_ctx* h, uint hashtype);
int hash_add(hash_ctx* h, uchar* msg, uint msglen);
int hash_final(hash_ctx* h, uchar* out);
int hash(hash_ctx* h, uchar* msg, uint msglen, uchar* out);
#endif