1 #ifndef HASHUTIL_H 2 #define HASHUTIL_H 3 4 #include "conf.h" 5 #include "mdfour.h" 6 #include <inttypes.h> 7 8 struct file_hash 9 { 10 uint8_t hash[16]; 11 uint32_t size; 12 }; 13 14 unsigned hash_from_string(void *str); 15 unsigned hash_from_int(int i); 16 int strings_equal(void *str1, void *str2); 17 int file_hashes_equal(struct file_hash *fh1, struct file_hash *fh2); 18 19 #define HASH_SOURCE_CODE_OK 0 20 #define HASH_SOURCE_CODE_ERROR 1 21 #define HASH_SOURCE_CODE_FOUND_DATE 2 22 #define HASH_SOURCE_CODE_FOUND_TIME 4 23 24 int check_for_temporal_macros(const char *str, size_t len); 25 int hash_source_code_string( 26 struct conf *conf, struct mdfour *hash, const char *str, size_t len, 27 const char *path); 28 int hash_source_code_file( 29 struct conf *conf, struct mdfour *hash, const char *path); 30 bool hash_command_output(struct mdfour *hash, const char *command, 31 const char *compiler); 32 bool hash_multicommand_output(struct mdfour *hash, const char *command, 33 const char *compiler); 34 35 #endif 36