dazibao/src/hash.h

26 lines
671 B
C
Raw Normal View History

2020-03-31 18:28:12 +02:00
#ifndef HASH_H
#define HASH_H
#include <openssl/sha.h>
2020-03-31 18:28:12 +02:00
#include "tlv.h"
#include "parser.h"
#include "node.h"
2020-03-31 18:28:12 +02:00
// Hash a single data
void hash_data(struct 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
void hash_network(struct 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
void concat_data(struct 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);
#endif