Fingerprint_Card

Loading...
Searching...
No Matches
sha256.h
Go to the documentation of this file.
1/*
2* SHA-256 implementation.
3*
4* Copyright (c) 2010 Ilya O. Levin, http://www.literatecode.com
5*
6* Permission to use, copy, modify, and distribute this software for any
7* purpose with or without fee is hereby granted, provided that the above
8* copyright notice and this permission notice appear in all copies.
9*
10* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18#ifdef _MSC_VER
19#ifndef uint8_t
20 typedef unsigned __int8 uint8_t;
21#endif
22#ifndef uint32_t
23 typedef unsigned __int32 uint32_t;
24#endif
25#ifndef uint64_t
26 typedef __int64 int64_t;
27 typedef unsigned __int64 uint64_t;
28#endif
29#else
30#include <stdint.h>
31#endif
32
33#ifdef __cplusplus
34 extern "C"
35{
36#endif
37
38 typedef struct {
39 uint32_t buf[16];
40 uint32_t hash[8];
41 uint32_t len[2];
42 } sha256_context;
43
44 void sha256_init(sha256_context *);
45 void sha256_hash(sha256_context *, uint8_t * /* data */, uint32_t /* len */);
46 void sha256_done(sha256_context *, uint8_t * /* hash */);
47
48#ifdef __cplusplus
49}
50#endif
sha256_init
void sha256_init(sha256_context *)
Definition sha256.c:132
sha256_done
void sha256_done(sha256_context *, uint8_t *)
Definition sha256.c:160
sha256_hash
void sha256_hash(sha256_context *, uint8_t *, uint32_t)
Definition sha256.c:143
sha256_context
Definition sha256.h:38
sha256_context::len
uint32_t len[2]
Definition sha256.h:41
sha256_context::hash
uint32_t hash[8]
Definition sha256.h:40
sha256_context::buf
uint32_t buf[16]
Definition sha256.h:39