diff options
| author | Yawning Angel <yawning@schwanenlied.me> | 2024-11-02 11:35:17 +0900 |
|---|---|---|
| committer | Yawning Angel <yawning@schwanenlied.me> | 2025-03-23 19:14:33 +0900 |
| commit | 982ab11aa1fa1f1b690b1dbe0e6ad0d070a15bbc (patch) | |
| tree | bcb223bc794607f3cd711bd5f1aef33994379c6a /core/crypto/sha2/sha2.odin | |
| parent | f3f5fbd37315f8ebe39c1fa404c2bcf905b8d316 (diff) | |
core/crypto/sha2: Use hardware SHA224/256 when available (AMD64)
Diffstat (limited to 'core/crypto/sha2/sha2.odin')
| -rw-r--r-- | core/crypto/sha2/sha2.odin | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/crypto/sha2/sha2.odin b/core/crypto/sha2/sha2.odin index 1c1ce11b6..bf726c20c 100644 --- a/core/crypto/sha2/sha2.odin +++ b/core/crypto/sha2/sha2.odin @@ -15,9 +15,9 @@ package sha2 zhibog, dotbmp: Initial implementation. */ -import "core:encoding/endian" +@(require) import "core:encoding/endian" import "core:math/bits" -import "core:mem" +@(require) import "core:mem" // DIGEST_SIZE_224 is the SHA-224 digest size in bytes. DIGEST_SIZE_224 :: 28 @@ -397,6 +397,11 @@ SHA512_F4 :: #force_inline proc "contextless" (x: u64) -> u64 { @(private) sha2_transf :: proc "contextless" (ctx: ^$T, data: []byte) { when T == Context_256 { + if is_hardware_accelerated_256() { + sha256_transf_hw(ctx, data) + return + } + w: [64]u32 wv: [8]u32 t1, t2: u32 |