add if statement and declaration

This commit is contained in:
2025-07-13 03:34:31 +01:00
parent 744e3c281d
commit f7ff3393f0
36 changed files with 587 additions and 165 deletions

View File

@@ -1,10 +1,12 @@
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include "siphash/siphash.h"
#include "hash_data.h"
uint8_t siphash_key[16];
const uint8_t siphash_key_fixed_for_translator[16] = {218, 19, 245, 136, 128, 160, 122, 81, 249, 147, 111, 230, 174, 145, 125 ,218};
uint8_t empty_siphash_key[16];
void generate_siphash_key(uint8_t hash_key[16]) {
@@ -15,7 +17,7 @@ void generate_siphash_key(uint8_t hash_key[16]) {
close(fd);
}
uint64_t siphash64_bytes(const void *data, size_t len,uint8_t hash_key[16]) {
uint64_t siphash64_bytes(const void *data, size_t len,const uint8_t hash_key[16]) {
uint8_t out[8];
if (siphash(data, len, hash_key, out, sizeof(out)) != 0)
return 0;

View File

@@ -4,8 +4,9 @@
#include <stdint.h>
extern uint8_t siphash_key[16];
extern const uint8_t siphash_key_fixed_for_translator[16];
extern uint8_t empty_siphash_key[16];
void generate_siphash_key(uint8_t siphash_key[16]);
uint64_t siphash64_bytes(const void *data, size_t len,uint8_t siphash_key[16]);
uint64_t siphash64_bytes(const void *data, size_t len,const uint8_t hash_key[16]);
#endif //HASH_DATA_H