Debian Codegraph @

contrib/sha256.h

raw symbols SCIP
1 /*********************************************************************
2 * Filename: sha256.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 * File copied from the project: https://github.com/B-Con/crypto-algorithms
9 * License (quoting from author's github project):
10 * This code is released into the public domain free of any restrictions. The author requests
11 * acknowledgement if the code is used, but does not require it. This code is provided free of any
12 * liability and without any quality claims by the author.
13 *
14 *********************************************************************/
15
16 #ifndef SHA256_H
17 #define SHA256_H
18
19 /*************************** HEADER FILES ***************************/
20 #include <stddef.h>
21 #include <stdint.h>
22
23 /****************************** MACROS ******************************/
24 #define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
25
26 /**************************** DATA TYPES ****************************/
27
28 typedef struct {
29 uint8_t data[64];
30 uint32_t datalen;
31 unsigned long long bitlen;
32 uint32_t state[8];
33 } SHA256_CTX;
34
35 /*********************** FUNCTION DECLARATIONS **********************/
36 void _librist_SHA256_Transform(SHA256_CTX *ctx, const uint8_t data[]);
37 void _librist_SHA256_Init(SHA256_CTX *ctx);
38 void _librist_SHA256_Update(SHA256_CTX *ctx, const uint8_t data[], size_t len);
39 void _librist_SHA256_Final(SHA256_CTX *ctx, uint8_t hash[]);
40
41 #endif // SHA256_H