diff options
Diffstat (limited to 'src/microhttpd/sha256.h')
-rw-r--r-- | src/microhttpd/sha256.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/microhttpd/sha256.h b/src/microhttpd/sha256.h index 88a558fc..3b866af2 100644 --- a/src/microhttpd/sha256.h +++ b/src/microhttpd/sha256.h | |||
@@ -30,25 +30,42 @@ | |||
30 | #include <stdint.h> | 30 | #include <stdint.h> |
31 | #include <stddef.h> | 31 | #include <stddef.h> |
32 | 32 | ||
33 | |||
33 | /** | 34 | /** |
34 | * Digest is kept internally as 8 32-bit words. | 35 | * Digest is kept internally as 8 32-bit words. |
35 | */ | 36 | */ |
36 | #define _SHA256_DIGEST_LENGTH 8 | 37 | #define _SHA256_DIGEST_LENGTH 8 |
37 | 38 | ||
38 | /** | 39 | /** |
40 | * Number of bits in single SHA-256 word | ||
41 | */ | ||
42 | #define SHA256_WORD_SIZE_BITS 32 | ||
43 | |||
44 | /** | ||
45 | * Number of bytes in single SHA-256 word | ||
46 | * used to process data | ||
47 | */ | ||
48 | #define SHA256_BYTES_IN_WORD (SHA256_WORD_SIZE_BITS / 8) | ||
49 | |||
50 | /** | ||
39 | * Size of SHA-256 digest in bytes | 51 | * Size of SHA-256 digest in bytes |
40 | */ | 52 | */ |
41 | #define SHA256_DIGEST_SIZE (_SHA256_DIGEST_LENGTH * 4) | 53 | #define SHA256_DIGEST_SIZE (_SHA256_DIGEST_LENGTH * SHA256_BYTES_IN_WORD) |
42 | 54 | ||
43 | /** | 55 | /** |
44 | * Size of SHA-256 digest string in chars | 56 | * Size of SHA-256 digest string in chars including termination NUL |
45 | */ | 57 | */ |
46 | #define SHA256_DIGEST_STRING_SIZE ((SHA256_DIGEST_SIZE) * 2 + 1) | 58 | #define SHA256_DIGEST_STRING_SIZE ((SHA256_DIGEST_SIZE) * 2 + 1) |
47 | 59 | ||
48 | /** | 60 | /** |
61 | * Size of single processing block in bits | ||
62 | */ | ||
63 | #define SHA256_BLOCK_SIZE_BITS 512 | ||
64 | |||
65 | /** | ||
49 | * Size of single processing block in bytes | 66 | * Size of single processing block in bytes |
50 | */ | 67 | */ |
51 | #define SHA256_BLOCK_SIZE 64 | 68 | #define SHA256_BLOCK_SIZE (SHA256_BLOCK_SIZE_BITS / 8) |
52 | 69 | ||
53 | 70 | ||
54 | struct sha256_ctx | 71 | struct sha256_ctx |