feat(sha1): add SHA1 functions

This commit is contained in:
fallenoak 2022-12-29 15:55:12 -06:00 committed by GitHub
parent 7e2cb5242e
commit 1eb1d281a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 269 additions and 0 deletions

20
common/SHA1.hpp Normal file
View file

@ -0,0 +1,20 @@
#ifndef COMMON_SHA1_HPP
#define COMMON_SHA1_HPP
#include <cstdint>
#define SHA1_DIGEST_SIZE 20
typedef struct {
uint32_t state[5];
uint32_t count[2];
char buffer[64];
} SHA1_CONTEXT;
void SHA1_Final(uint8_t* const digest, SHA1_CONTEXT* context);
void SHA1_Init(SHA1_CONTEXT* context);
void SHA1_Update(SHA1_CONTEXT* context, const uint8_t* data, uint32_t len);
#endif