1 /* sha1.h */ 2 #ifndef SHA1_H 3 #define SHA1_H 4 #include "ustd.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 #define sha1_block_size 64 11 #define sha1_hash_size 20 12 13 /* algorithm context */ 14 typedef struct sha1_ctx 15 { 16 unsigned char message[sha1_block_size]; /* 512-bit buffer for leftovers */ 17 uint64_t length; /* number of processed bytes */ 18 unsigned hash[5]; /* 160-bit algorithm internal hashing state */ 19 } sha1_ctx; 20 21 /* hash functions */ 22 23 void rhash_sha1_init(sha1_ctx* ctx); 24 void rhash_sha1_update(sha1_ctx* ctx, const unsigned char* msg, size_t size); 25 void rhash_sha1_final(sha1_ctx* ctx, unsigned char* result); 26 27 #ifdef __cplusplus 28 } /* extern "C" */ 29 #endif /* __cplusplus */ 30 31 #endif /* SHA1_H */ 32