7/19
This commit is contained in:
1 parent
0d8859b063
commit
7b22e3746a
29 files changed
+3949
-193
No files matched your search
@@ -0,0 +1,26 @@
|
||||
#ifndef GL_SHA256_H_
|
||||
#define GL_SHA256_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define GL_SHA256_DIGEST_SIZE 32
|
||||
#define GL_SHA256_HEX_SIZE (GL_SHA256_DIGEST_SIZE * 2 + 1)
|
||||
|
||||
typedef struct {
|
||||
uint32_t state[8];
|
||||
uint64_t bitlen;
|
||||
uint8_t data[64];
|
||||
size_t datalen;
|
||||
}
|
||||
gl_sha256_ctx_t;
|
||||
|
||||
void gl_sha256_init(gl_sha256_ctx_t *ctx);
|
||||
void gl_sha256_update(gl_sha256_ctx_t *ctx, const uint8_t *data, size_t len);
|
||||
void gl_sha256_final(gl_sha256_ctx_t *ctx, uint8_t digest[GL_SHA256_DIGEST_SIZE]);
|
||||
|
||||
void gl_sha256_to_hex(const uint8_t digest[GL_SHA256_DIGEST_SIZE], char *out);
|
||||
|
||||
int gl_sha256_file(const char *path, char *hex_out);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user