Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
3085 rexy 1
#pragma once
2
/*********************************************************************
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
#include "stdint.h"
14
 
15
/*************************** HEADER FILES ***************************/
16
#include <stddef.h>
17
 
18
/****************************** MACROS ******************************/
19
#define SHA256_BLOCK_SIZE 32            // SHA256 outputs a 32 byte digest
20
 
21
typedef struct {
22
	uint8_t data[64];
23
	uint32_t datalen;
24
	unsigned long long bitlen;
25
	uint32_t state[8];
26
} SHA256_CONTEXT;
27
 
28
 
29
 
30
/*********************** FUNCTION DECLARATIONS **********************/
31
void SHA256Init(SHA256_CONTEXT* ctx);
32
void SHA256Update(SHA256_CONTEXT* ctx, const uint8_t data[], size_t len);
33
void SHA256Final(SHA256_CONTEXT* ctx, uint8_t hash[]);
34
 
35
#endif   // SHA256_H