Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
tpruvot
GitHub Repository: tpruvot/cpuminer-multi
Path: blob/linux/crypto/c_groestl.h
1201 views
1
#ifndef __hash_h
2
#define __hash_h
3
/*
4
#include "crypto_uint8.h"
5
#include "crypto_uint32.h"
6
#include "crypto_uint64.h"
7
#include "crypto_hash.h"
8
9
typedef crypto_uint8 uint8_t;
10
typedef crypto_uint32 uint32_t;
11
typedef crypto_uint64 uint64_t;
12
*/
13
#include <stdint.h>
14
15
#include "hash.h"
16
17
/* some sizes (number of bytes) */
18
#define ROWS 8
19
#define LENGTHFIELDLEN ROWS
20
#define COLS512 8
21
22
#define SIZE512 (ROWS*COLS512)
23
24
#define ROUNDS512 10
25
#define HASH_BIT_LEN 256
26
27
#define ROTL32(v, n) ((((v)<<(n))|((v)>>(32-(n))))&li_32(ffffffff))
28
29
30
#define li_32(h) 0x##h##u
31
#define EXT_BYTE(var,n) ((uint8_t)((uint32_t)(var) >> (8*n)))
32
#define u32BIG(a) \
33
((ROTL32(a,8) & li_32(00FF00FF)) | \
34
(ROTL32(a,24) & li_32(FF00FF00)))
35
36
37
/* NIST API begin */
38
typedef struct {
39
uint32_t chaining[SIZE512/sizeof(uint32_t)]; /* actual state */
40
uint32_t block_counter1,
41
block_counter2; /* message block counter(s) */
42
BitSequence buffer[SIZE512]; /* data buffer */
43
int buf_ptr; /* data buffer pointer */
44
int bits_in_last_byte; /* no. of message bits in last byte of
45
data buffer */
46
} groestlHashState;
47
48
/*void Init(hashState*);
49
void Update(hashState*, const BitSequence*, DataLength);
50
void Final(hashState*, BitSequence*); */
51
void groestl(const BitSequence*, DataLength, BitSequence*);
52
/* NIST API end */
53
54
/*
55
int crypto_hash(unsigned char *out,
56
const unsigned char *in,
57
unsigned long long len);
58
*/
59
60
#endif /* __hash_h */
61
62