CTS-SAT-1-OBC-Firmware
Loading...
Searching...
No Matches
sha256.h
Go to the documentation of this file.
1/*********************************************************************
2* Source: https://github.com/B-Con/crypto-algorithms
3* Filename: sha256.h
4* Author: Brad Conte (brad AT bradconte.com)
5* Copyright:
6* Disclaimer: This code is presented "as is" without any guarantees.
7* Details: Defines the API for the corresponding SHA1 implementation.
8*********************************************************************/
9
10#ifndef SHA256_H
11#define SHA256_H
12
13/*************************** HEADER FILES ***************************/
14#include <stddef.h>
15#include <stdint.h>
16
17/****************************** MACROS ******************************/
18#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
19
20/**************************** DATA TYPES ****************************/
21typedef uint8_t BYTE;
22typedef uint32_t WORD;
23
24typedef struct {
27 unsigned long long bitlen;
30
31/*********************** FUNCTION DECLARATIONS **********************/
32void sha256_init(SHA256_CTX *ctx);
33void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);
34void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
35
36
37void CRYPT_compute_sha256_hash(const uint8_t message[], size_t message_length, uint8_t hash[32]);
38
39#endif // SHA256_H
void sha256_final(SHA256_CTX *ctx, BYTE hash[])
Definition sha256.c:115
uint8_t BYTE
Definition sha256.h:21
void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len)
Definition sha256.c:100
uint32_t WORD
Definition sha256.h:22
void CRYPT_compute_sha256_hash(const uint8_t message[], size_t message_length, uint8_t hash[32])
Computes the SHA256 hash of the message and stores the 32 byte hash at hash.
Definition sha256.c:166
void sha256_init(SHA256_CTX *ctx)
Definition sha256.c:86
Definition sha256.h:24
WORD state[8]
Definition sha256.h:28
unsigned long long bitlen
Definition sha256.h:27
BYTE data[64]
Definition sha256.h:25
WORD datalen
Definition sha256.h:26