-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.cpp
39 lines (30 loc) · 906 Bytes
/
main.cpp
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
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include "PoW.h"
#include "common.h"
#include "my_rand48_r.h"
#include "oneWayFunction.h"
int main(int argc, const char *argv[]) {
if (argc != 2) {
printf("Usage: %s message\n", argv[0]);
exit(-1);
}
const char *mess = argv[1];
uint32_t messLen = (uint32_t)strlen(mess);
uint8_t input[INPUT_LEN];
memset(input, 0, INPUT_LEN*sizeof(uint8_t));
memcpy(input, mess, messLen*sizeof(char));
// Test for oneWayFunction
initOneWayFunction();
testOneWayFunction(mess, 5000000);
testPowFunction(input, 5000);
/* uint8_t Maddr[WORK_MEMORY_SIZE], output[OUTPUT_LEN];
memset(Maddr, 0, WORK_MEMORY_SIZE*sizeof(uint8_t));
for (int i = 0; i < 100; ++i)
powFunction(input, Maddr, output);
view_data_u8("PoW", output, OUTPUT_LEN); */
return 0;
}