-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.h
46 lines (38 loc) · 1.49 KB
/
functions.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
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <openssl/ripemd.h>
#include "sha256.h"
#include "libbase58.h"
typedef unsigned long long POSITION;
typedef struct s_txinput{
unsigned char prev_tx_hash[32];
unsigned int prev_tx_index;
} txinput;
typedef struct s_txoutput{
char address[64];
unsigned int s_address;
unsigned int index;
} txoutput;
unsigned int FourByteToInt(unsigned char *buffer);
unsigned int CheckMagicNo(unsigned char *buffer);
unsigned long long VarIntToUnsignedLongLong(int fd, int pos);
void PrintHash(unsigned char *buffer);
void ParseBlockXML(int fd, int pos, FILE *stream);
POSITION NextBlockPosition(int fd, POSITION pos);
POSITION NextTxPosition(int fd, POSITION pos);
POSITION JumpAfterVarInt(int fd, POSITION pos);
POSITION GoToTxCounter(int fd, POSITION pos);
POSITION GoToFirstTx(int fd, POSITION pos);
void CalcBlockHash(int fd, POSITION pos, unsigned char *hash);
void GetBlockHeader(int fd, POSITION pos, unsigned char *header);
unsigned long long GetTxCounter(int fd, POSITION pos);
void CalcTxHash(int fd, POSITION pos, unsigned char *hash);
void PrintTxInputs(int fd, POSITION pos);
void PrintTxOutputs(int fd, POSITION pos);
unsigned long long ExtractTxInputs(int fd, POSITION pos, txinput **result);
unsigned long long ExtractTxOutputs(int fd, POSITION pos, txoutput **result);
void ScriptToAddress(unsigned char *script, unsigned long long len, char *result, unsigned int *s_result);