-
Notifications
You must be signed in to change notification settings - Fork 3
/
PoW.h
43 lines (33 loc) · 1.11 KB
/
PoW.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
#ifndef POW_H
#define POW_H
#include <stdint.h>
#include <string.h>
#include "common.h"
#define WORK_MEMORY_SIZE (1024*1024)
#ifdef __cplusplus
extern "C" {
#endif
/*
* Step 1: Initialize working memory.
*/
void initWorkMemory(uint8_t *input, uint32_t inputLen, uint8_t *Maddr, const uint32_t K);
/*
* Step 2: Modify the working memory contents.
*/
void modifyWorkMemory(uint8_t *Maddr, const uint32_t L, const uint32_t C, uint8_t *result);
/*
* Step 3: Calculate the final result.
*/
void calculateFinalResult(uint8_t *Maddr, uint8_t *c, const uint32_t D, uint8_t *result);
/*
* Correctness & Performance test for Proof of work
*/
void testPowFunction(uint8_t *mess, uint32_t messLen, const int64_t iterNum);
void powNistTest(const char *outFileName);
void InitpowFunction(uint8_t * input, uint32_t messLen, uint8_t * output);
void RunPowFunction(uint8_t * input, uint32_t messLen,uint8_t * Maddr, uint8_t * output);
void powFunction(uint8_t *input, uint32_t inputLen, uint8_t *Maddr, uint8_t *output);
#ifdef __cplusplus
}
#endif
#endif