delete misc
This commit is contained in:
parent
7db155e671
commit
a82c8cb60a
27
src/misc.c
27
src/misc.c
@ -1,27 +0,0 @@
|
||||
#include "misc.h"
|
||||
|
||||
char *hash_data(pub_data *data) {
|
||||
// Copy data to buf to pass it as string argument
|
||||
char cpy_data[data->length + 1];
|
||||
memcpy(cpy_data, data->data, data->length);
|
||||
cpy_data[data->length] = '\0';
|
||||
|
||||
// All three fields are concatenated into a single buf
|
||||
char *concat_data = concat(3, data->id, data->seqno, data->data);
|
||||
|
||||
// The resulting buf is hashed
|
||||
char *hash = SHA256(concat_data, data->length + 10, 0);
|
||||
|
||||
// Free the concatenated buf
|
||||
free(concat_data);
|
||||
|
||||
return hash_trunc(hash);
|
||||
}
|
||||
|
||||
char *hash_network(list *data_list) {
|
||||
|
||||
}
|
||||
|
||||
char *hash_trunc(char *hash256bit);
|
||||
|
||||
char *concat(int argc, ...);
|
23
src/misc.h
23
src/misc.h
@ -1,23 +0,0 @@
|
||||
#ifndef MISC_H
|
||||
#define MISC_H
|
||||
|
||||
#include <openssl/sha.h>
|
||||
#include <stdarg.h>
|
||||
#include "node.h"
|
||||
#include "tlv.h"
|
||||
|
||||
// General list
|
||||
typedef struct list {
|
||||
void *data;
|
||||
void *next;
|
||||
} list;
|
||||
|
||||
// Hash functions
|
||||
char *hash_data(pub_data *data);
|
||||
char *hash_network(list *data_list);
|
||||
char *hash_trunc(char *hash256bit);
|
||||
char *concat(int argc, ...);
|
||||
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user