2020-03-31 18:28:12 +02:00
|
|
|
#ifndef HASH_H
|
|
|
|
#define HASH_H
|
|
|
|
|
|
|
|
#include <openssl/sha.h>
|
2020-04-16 15:27:32 +02:00
|
|
|
#include <stdint.h>
|
2020-04-14 19:32:15 +02:00
|
|
|
|
2020-03-31 18:28:12 +02:00
|
|
|
#include "tlv.h"
|
2020-04-14 19:32:15 +02:00
|
|
|
#include "parser.h"
|
|
|
|
#include "node.h"
|
2020-03-31 18:28:12 +02:00
|
|
|
|
|
|
|
// Hash a single data
|
2020-04-16 15:08:22 +02:00
|
|
|
void hash_data(pub_data *data, unsigned char *buf);
|
2020-03-31 18:28:12 +02:00
|
|
|
|
|
|
|
// Hash every data contained in data_list then return a network hash
|
2020-04-16 15:08:22 +02:00
|
|
|
void hash_network(list *data_list, unsigned char *buf);
|
2020-03-31 18:28:12 +02:00
|
|
|
|
|
|
|
// Truncate 32 octet hash to 16 octets
|
|
|
|
void hash_trunc(unsigned char *hash256bit, unsigned char *buf);
|
|
|
|
|
|
|
|
// Concat all fields of data and put them in buf
|
2020-04-16 15:08:22 +02:00
|
|
|
void concat_data(pub_data *data, unsigned char *buf);
|
2020-03-31 18:28:12 +02:00
|
|
|
|
|
|
|
// Concat hash2 to hash1 (hash1 is modified)
|
|
|
|
void concat_hash(unsigned char *hash1, unsigned char *hash2, size_t size);
|
|
|
|
|
2020-04-14 19:32:15 +02:00
|
|
|
#endif
|