-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathread.c
More file actions
55 lines (45 loc) · 954 Bytes
/
read.c
File metadata and controls
55 lines (45 loc) · 954 Bytes
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
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void main (int argc, char **argv) {
FILE *fp;
unsigned char buf[1024];
int i;
if(argc<=1) {
printf("Usage: %s <plot filename>\n", argv[0]);
exit(0);
}
fp=fopen(argv[1],"r");
if(!fp) {
printf("Cannot open input file for reading.\n");
exit(1);
}
bzero(buf,1024);
fread(buf,19,1,fp);
printf("File type: %s\n",buf);
fread(buf,32,1,fp);
printf("PlotID: ");
for(i=0;i<32;i++) printf("%02x",buf[i]);
printf("\n");
fread(buf,1,1,fp);
printf("k size: %d\n",buf[0]);
fread(buf,2,1,fp);
i=buf[1];
bzero(buf,1024);
fread(buf,i,1,fp);
printf("Version: %s\n",buf);
fread(buf,2,1,fp);
if(buf[1]!=128) {
printf("Unsupported memo size.\n");
exit(1);
}
fread(buf,128,1,fp);
printf("Pool public key: ");
for(i=0;i<128;i++) {
if(i==48)printf("\nFarmer public key: ");
if(i==96)printf("\nLocal sk: ");
printf("%02x",buf[i]);
}
printf("\n");
fclose(fp);
}