core/crypto: Expose the block sizes for every hash algorithm

While I just went and made this private, this information is required
for keying HMAC.
This commit is contained in:
Yawning Angel
2024-02-07 00:37:18 +09:00
parent bc160d2eb7
commit 7a8b1669b0
11 changed files with 100 additions and 42 deletions
+4 -4
View File
@@ -18,9 +18,12 @@ import "core:encoding/endian"
import "core:math/bits"
import "core:mem"
// DIGEST_SIZE is the SM3 digest size.
// DIGEST_SIZE is the SM3 digest size in bytes.
DIGEST_SIZE :: 32
// BLOCK_SIZE is the SM3 block size in bytes.
BLOCK_SIZE :: 64
// Context is a SM3 instance.
Context :: struct {
state: [8]u32,
@@ -133,9 +136,6 @@ reset :: proc(ctx: ^Context) {
SM3 implementation
*/
@(private)
BLOCK_SIZE :: 64
@(private)
IV := [8]u32 {
0x7380166f, 0x4914b2b9, 0x172442d7, 0xda8a0600,