Helmut Tschemernjak / RadioShuttle-STM32L4

Dependents:   Turtle_RadioShuttle

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sha256.h Source File

sha256.h

00001 /*********************************************************************
00002 * Filename:   sha256.h
00003 * Author:     Brad Conte (brad AT bradconte.com)
00004 * Copyright:
00005 * Disclaimer: This code is presented "as is" without any guarantees.
00006 * Details:    Defines the API for the corresponding SHA1 implementation.
00007 *********************************************************************/
00008 
00009 #ifndef SHA256_H
00010 #define SHA256_H
00011 
00012 /*************************** HEADER FILES ***************************/
00013 #include <stddef.h>
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018     
00019 /****************************** MACROS ******************************/
00020 #define SHA256_BLOCK_SIZE 32            // SHA256 outputs a 32 byte digest
00021 
00022 /**************************** DATA TYPES ****************************/
00023 typedef unsigned char BYTE;             // 8-bit byte
00024 typedef unsigned int  WORD;             // 32-bit word, change to "long" for 16-bit machines
00025 
00026 typedef struct {
00027     BYTE data[64];
00028     WORD datalen;
00029     unsigned long long bitlen;
00030     WORD state[8];
00031 } SHA256_CTX;
00032 
00033 /*********************** FUNCTION DECLARATIONS **********************/
00034 void sha256_init(SHA256_CTX *ctx);
00035 void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);
00036 void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
00037 
00038 #ifdef __cplusplus
00039 }
00040 #endif
00041 
00042 #endif   // SHA256_H