core/crypto/hash: Make the low level interface allocator-less

Just (ab)using reflect to victory is probably fine.
This commit is contained in:
Yawning Angel
2024-02-07 00:37:18 +09:00
parent 7a8b1669b0
commit 2357293e05
3 changed files with 150 additions and 181 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ hash_string_to_buffer :: proc(algorithm: Algorithm, data: string, hash: []byte)
hash_bytes_to_buffer :: proc(algorithm: Algorithm, data, hash: []byte) {
ctx: Context
init(&ctx, algorithm, context.temp_allocator)
init(&ctx, algorithm)
update(&ctx, data)
final(&ctx, hash)
}
@@ -56,7 +56,7 @@ hash_stream :: proc(
) {
ctx: Context
init(&ctx, algorithm, context.temp_allocator)
init(&ctx, algorithm)
buffer_size := block_size(&ctx) * 4
buf := make([]byte, buffer_size, context.temp_allocator)