-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmerkle-tree.h
55 lines (42 loc) · 839 Bytes
/
merkle-tree.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
49
50
51
52
53
54
55
#ifndef MERKLE_TREE_H_
#define MERKLE_TREE_H_
#include <immintrin.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <stdint.h>
#define sklen 128
#define pklen 72
#define rglen 64
#define ranlen 128
#define usr 1048576//2^h
#define h 20 //must be even
#define l 9
#define merlen (2*pklen-sklen)
typedef unsigned char uint8;
typedef unsigned long int uint32;
typedef unsigned char uint8;
extern int key_length;
typedef struct node{
uint8 key[pklen];
}node;
typedef struct mssnode{
uint8 key[pklen];
uint32 height;
uint32 indx;
}mssnode;
typedef struct sk_node{
uint8 key[sklen];
}sk_node;
typedef struct treehash{
node v;
mssnode treestack[h-1];
uint32 finalized;
uint32 startleaf;
uint32 lowheight;
int top;
}treehash;
treehash instance[h-2];
#endif