| 1 | /********************************************************************* |
| 2 | * Filename: sha1.h |
| 3 | * Author: Brad Conte (brad AT bradconte.com) |
| 4 | * Copyright: |
| 5 | * Disclaimer: This code is presented "as is" without any guarantees. |
| 6 | * Details: Defines the API for the corresponding SHA1 implementation. |
| 7 | *********************************************************************/ |
| 8 | |
| 9 | #ifndef SHA1_H |
| 10 | #define SHA1_H |
| 11 | |
| 12 | /*************************** HEADER FILES ***************************/ |
| 13 | #include <stddef.h> |
| 14 | |
| 15 | #include "crypto_types.h" |
| 16 | |
| 17 | /****************************** MACROS ******************************/ |
| 18 | #define SHA1_BLOCK_SIZE 20 // SHA1 outputs a 20 byte digest |
| 19 | |
| 20 | /**************************** DATA TYPES ****************************/ |
| 21 | typedef struct { |
| 22 | BYTE data[64]; |
| 23 | WORD datalen; |
| 24 | unsigned long long bitlen; |
| 25 | WORD state[5]; |
| 26 | WORD k[4]; |
| 27 | } SHA1_CTX; |
| 28 | |
| 29 | /*********************** FUNCTION DECLARATIONS **********************/ |
| 30 | void sha1_init(SHA1_CTX *ctx); |
| 31 | void sha1_update(SHA1_CTX *ctx, const BYTE data[], size_t len); |
| 32 | void sha1_final(SHA1_CTX *ctx, BYTE hash[]); |
| 33 | |
| 34 | #endif // SHA1_H |