Skip to content

Commit

Permalink
use big endian in sha256
Browse files Browse the repository at this point in the history
  • Loading branch information
sirasistant authored and dbanks12 committed Oct 28, 2024
1 parent 19f9c48 commit 7eb9702
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions noir/noir-repo/noir_stdlib/src/hash/sha256.nr
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,9 @@ fn hash_final_block(msg_block: MSG_BLOCK, mut state: STATE) -> HASH {

// Return final hash as byte array
for j in 0..8 {
let h_bytes: [u8; 4] = (state[7 - j] as Field).to_le_bytes();
let h_bytes: [u8; 4] = (state[j] as Field).to_be_bytes();
for k in 0..4 {
out_h[31 - 4 * j - k] = h_bytes[k];
out_h[4 * j + k] = h_bytes[k];
}
}

Expand Down

0 comments on commit 7eb9702

Please sign in to comment.