RadioShuttle Lib for the STM32 L4 Heltec Board

Dependents:   Turtle_RadioShuttle

Committer:
Helmut Tschemernjak
Date:
Mon Mar 04 09:41:41 2019 +0100
Revision:
11:91bc7ef20f21
Parent:
0:0c31756924a2
Updated lib

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Helmut64 0:0c31756924a2 1 /*********************************************************************
Helmut64 0:0c31756924a2 2 * Filename: sha256.h
Helmut64 0:0c31756924a2 3 * Author: Brad Conte (brad AT bradconte.com)
Helmut64 0:0c31756924a2 4 * Copyright:
Helmut64 0:0c31756924a2 5 * Disclaimer: This code is presented "as is" without any guarantees.
Helmut64 0:0c31756924a2 6 * Details: Defines the API for the corresponding SHA1 implementation.
Helmut64 0:0c31756924a2 7 *********************************************************************/
Helmut64 0:0c31756924a2 8
Helmut64 0:0c31756924a2 9 #ifndef SHA256_H
Helmut64 0:0c31756924a2 10 #define SHA256_H
Helmut64 0:0c31756924a2 11
Helmut64 0:0c31756924a2 12 /*************************** HEADER FILES ***************************/
Helmut64 0:0c31756924a2 13 #include <stddef.h>
Helmut64 0:0c31756924a2 14
Helmut64 0:0c31756924a2 15 #ifdef __cplusplus
Helmut64 0:0c31756924a2 16 extern "C" {
Helmut64 0:0c31756924a2 17 #endif
Helmut64 0:0c31756924a2 18
Helmut64 0:0c31756924a2 19 /****************************** MACROS ******************************/
Helmut64 0:0c31756924a2 20 #define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
Helmut64 0:0c31756924a2 21
Helmut64 0:0c31756924a2 22 /**************************** DATA TYPES ****************************/
Helmut64 0:0c31756924a2 23 typedef unsigned char BYTE; // 8-bit byte
Helmut64 0:0c31756924a2 24 typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
Helmut64 0:0c31756924a2 25
Helmut64 0:0c31756924a2 26 typedef struct {
Helmut64 0:0c31756924a2 27 BYTE data[64];
Helmut64 0:0c31756924a2 28 WORD datalen;
Helmut64 0:0c31756924a2 29 unsigned long long bitlen;
Helmut64 0:0c31756924a2 30 WORD state[8];
Helmut64 0:0c31756924a2 31 } SHA256_CTX;
Helmut64 0:0c31756924a2 32
Helmut64 0:0c31756924a2 33 /*********************** FUNCTION DECLARATIONS **********************/
Helmut64 0:0c31756924a2 34 void sha256_init(SHA256_CTX *ctx);
Helmut64 0:0c31756924a2 35 void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);
Helmut64 0:0c31756924a2 36 void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
Helmut64 0:0c31756924a2 37
Helmut64 0:0c31756924a2 38 #ifdef __cplusplus
Helmut64 0:0c31756924a2 39 }
Helmut64 0:0c31756924a2 40 #endif
Helmut64 0:0c31756924a2 41
Helmut64 0:0c31756924a2 42 #endif // SHA256_H