yuezonghe | c78e2ef | 2025-02-13 17:57:46 -0800 | [diff] [blame^] | 1 | /*******************************************************************************
|
| 2 | * Author : author
|
| 3 | * Version : V1.0
|
| 4 | * Date : 2021-07-27
|
| 5 | * Description : util_sha256.h
|
| 6 | ********************************************************************************/
|
| 7 |
|
| 8 | #ifndef __UTIL_SHA256_H__
|
| 9 | #define __UTIL_SHA256_H__
|
| 10 |
|
| 11 | /********************************* Include File ********************************/
|
| 12 | #include <stdint.h>
|
| 13 |
|
| 14 |
|
| 15 | /********************************* Macro Definition ****************************/
|
| 16 | #define UNI_SHA256_KEY_SIZE (64)
|
| 17 | #define UNI_SHA256_TARGET_SIZE (32)
|
| 18 |
|
| 19 |
|
| 20 | /********************************* Type Definition *****************************/
|
| 21 | typedef struct
|
| 22 | {
|
| 23 | uint32_t total[2];
|
| 24 | uint32_t state[8];
|
| 25 | unsigned char buffer[64];
|
| 26 | int type; //0:SHA-256, not 0: SHA-224
|
| 27 | }uni_sha256_s;
|
| 28 |
|
| 29 |
|
| 30 | /********************************* Function Prototype Definition ***************/ |
| 31 | void utils_sha256_init(uni_sha256_s *tex);
|
| 32 | void utils_sha256_starts(uni_sha256_s *tex);
|
| 33 | void utils_sha256_update(uni_sha256_s *tex, const unsigned char *in, uint32_t in_len);
|
| 34 | void utils_sha256_finish(uni_sha256_s *tex, uint8_t out[32]);
|
| 35 |
|
| 36 |
|
| 37 | #endif
|