core/crypto/sha1: odinfmt (NFC)

This commit is contained in:
Yawning Angel
2023-11-17 16:53:29 +09:00
parent 9d627e453a
commit b4e3da84c5
+4 -4
View File
@@ -10,9 +10,9 @@ package sha1
Implementation of the SHA1 hashing algorithm, as defined in RFC 3174 <https://datatracker.ietf.org/doc/html/rfc3174> Implementation of the SHA1 hashing algorithm, as defined in RFC 3174 <https://datatracker.ietf.org/doc/html/rfc3174>
*/ */
import "core:io"
import "core:mem" import "core:mem"
import "core:os" import "core:os"
import "core:io"
import "../util" import "../util"
@@ -136,8 +136,7 @@ final :: proc(ctx: ^Sha1_Context, hash: []byte) {
ctx.data[i] = 0x00 ctx.data[i] = 0x00
i += 1 i += 1
} }
} } else {
else {
ctx.data[i] = 0x80 ctx.data[i] = 0x80
i += 1 i += 1
for i < BLOCK_SIZE { for i < BLOCK_SIZE {
@@ -187,7 +186,8 @@ transform :: proc(ctx: ^Sha1_Context, data: []byte) {
m: [80]u32 m: [80]u32
for i, j = 0, 0; i < 16; i += 1 { for i, j = 0, 0; i < 16; i += 1 {
m[i] = u32(data[j]) << 24 + u32(data[j + 1]) << 16 + u32(data[j + 2]) << 8 + u32(data[j + 3]) m[i] =
u32(data[j]) << 24 + u32(data[j + 1]) << 16 + u32(data[j + 2]) << 8 + u32(data[j + 3])
j += 4 j += 4
} }
for i < 80 { for i < 80 {