mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
core/crypto/sha1: odinfmt (NFC)
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user