SHA256.h
Go to the documentation of this file.
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2  *
3  * LibTomCrypt is a library that provides various cryptographic
4  * algorithms in a highly modular and flexible manner.
5  *
6  * The library is free for all purposes without any express
7  * guarantee it works.
8  */
9 #include <cstdint>
10 #ifdef __cplusplus
11 extern "C"
12 {
13 #endif
14  typedef uint8_t ulong8;
15  typedef uint32_t ulong32;
16  typedef uint64_t ulong64;
17 
18  struct sha256_state
19  {
22  unsigned char buf[64];
23  };
24 
25  /* error codes [will be expanded in future releases] */
26  enum
27  {
28  CRYPT_OK = 0, /* Result OK */
29  CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */
30  CRYPT_INVALID_ARG, /* Generic invalid argument */
31  CRYPT_HASH_OVERFLOW /* Hash applied to too many bits */
32  };
33 
34  typedef union Hash_state
35  {
37  void* data;
38  } hash_state;
39 
40  int sha256_init(hash_state* md);
41  int sha256_process(hash_state* md, const ulong8* in, ulong32 inlen);
42  int sha256_done(hash_state* md, ulong8* hash);
43 #ifdef __cplusplus
44 }
45 #endif
sha256_init
int sha256_init(hash_state *md)
Definition: SHA256.cpp:180
Hash_state::data
void * data
Definition: SHA256.h:37
CRYPT_OK
@ CRYPT_OK
Definition: SHA256.h:28
sha256_done
int sha256_done(hash_state *md, ulong8 *hash)
CRYPT_FAIL_TESTVECTOR
@ CRYPT_FAIL_TESTVECTOR
Definition: SHA256.h:29
Hash_state
Definition: SHA256.h:34
ulong64
uint64_t ulong64
Definition: SHA256.h:16
sha256_state::state
ulong32 state[8]
Definition: SHA256.h:21
CRYPT_INVALID_ARG
@ CRYPT_INVALID_ARG
Definition: SHA256.h:30
ulong32
uint32_t ulong32
Definition: SHA256.h:15
sha256_state::length
ulong64 length
Definition: SHA256.h:20
ulong8
uint8_t ulong8
Definition: SHA256.h:14
sha256_state::curlen
ulong32 curlen
Definition: SHA256.h:21
sha256_state::buf
unsigned char buf[64]
Definition: SHA256.h:22
Hash_state::sha256
struct sha256_state sha256
Definition: SHA256.h:36
CRYPT_HASH_OVERFLOW
@ CRYPT_HASH_OVERFLOW
Definition: SHA256.h:31
hash_state
union Hash_state hash_state
sha256_process
int sha256_process(hash_state *md, const ulong8 *in, ulong32 inlen)
Definition: SHA256.cpp:212
sha256_state
Definition: SHA256.h:18


sick_safevisionary_base
Author(s):
autogenerated on Sat Oct 21 2023 02:24:26