CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
digest.h
Go to the documentation of this file.
1#pragma once
2
5
30
31#include <cx/cx.h>
32
34#define DIGEST_BLOCKSIZE 64
35
37typedef enum {
41 DIGEST_COUNT
43
46extern uint32 DigestSize[DIGEST_COUNT];
47
52typedef struct Digest {
54 uint32 size;
56 uint32 state[8];
58
72void digestInit(_Out_ Digest* digest, DigestType type);
73
89void digestUpdate(_Inout_ Digest* digest, _In_ uint8* data, uint32 size);
90
105void digestFinish(_Inout_ Digest* digest, _Out_ uint8* out);
106
107
void digestFinish(Digest *digest, uint8 *out)
uint32 DigestSize[DIGEST_COUNT]
#define DIGEST_BLOCKSIZE
Internal block size in bytes used by all supported digest algorithms.
Definition digest.h:34
void digestInit(Digest *digest, DigestType type)
void digestUpdate(Digest *digest, uint8 *data, uint32 size)
DigestType
Supported message digest algorithms.
Definition digest.h:37
@ DIGEST_SHA1
SHA-1 - 160-bit (20 bytes) - Deprecated for security.
Definition digest.h:39
@ DIGEST_SHA256
SHA-256 - 256-bit (32 bytes) - Secure and recommended.
Definition digest.h:40
@ DIGEST_MD5
MD5 - 128-bit (16 bytes) - Not cryptographically secure.
Definition digest.h:38
uint32 size
Total message size processed.
Definition digest.h:54
uint32 state[8]
Algorithm state (MD5: 4 words, SHA-1: 5 words, SHA-256: 8 words)
Definition digest.h:56
uint8 buffer[DIGEST_BLOCKSIZE]
Internal data buffer.
Definition digest.h:55
DigestType type
Algorithm being used.
Definition digest.h:53