solutions/zokrates_prover/.zokrates/stdlib/hashes/sha256/256bitPadded.zok

23 lines
576 B
Plaintext
Raw Permalink Normal View History

2023-12-05 06:06:28 +00:00
import "./512bit" as sha256;
// A function that takes a u32[8] array as input, pads it,
// and returns the sha256 output as a u32[8]
def main(u32[8] a) -> u32[8] {
// Hash is computed on 256 bits of input
// padding fits in the remaining 256 bits of the first block
// add dummy block (single "1" followed by "0" + total length)
u32[8] dummyblock1 = [ \
0x80000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000100
];
return sha256(a, dummyblock1);
}