forked from yifanlu/psvimgtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sha256.h
35 lines (25 loc) · 788 Bytes
/
sha256.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <stdint.h>
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
uint32_t total[2]; /*!< The number of Bytes processed. */
uint32_t state[8]; /*!< The intermediate digest state. */
unsigned char buffer[64]; /*!< The data block being processed. */
}
sha256_context;
void sha256_init(sha256_context *ctx);
int sha256_starts(sha256_context *ctx);
int sha256_update(sha256_context *ctx,
const unsigned char *input,
size_t ilen);
int sha256_final(sha256_context *ctx,
unsigned char output[32]);
void sha256_vector(size_t num_elem, const uint8_t *addr[], const size_t *len,
uint8_t *mac);
void sha256_copy(sha256_context *to, sha256_context *from);
#ifdef __cplusplus
}
#endif