solutions/zokrates_prover/.zokrates/stdlib/hashes/sha256/embed/1024bitPadded.zok

17 lines
663 B
Plaintext
Raw Normal View History

2023-12-05 06:06:28 +00:00
import "./1536bit" as sha256;
// Take two bool[256] arrays as input
// and returns their sha256 full round output as an array of 256 bool.
def main(bool[256] a, bool[256] b, bool[256] c, bool[256] d) -> bool[256] {
// Hash is computed on the full 1024bit block size
// padding does not fit in the first two blocks
// add dummy block (single "1" followed by "0" + total length)
bool[256] dummyblock1 = [true, ...[false; 255]];
// Total length of message is 1024 bits: 0b10000000000
bool[256] dummyblock2 = [...[false; 245], true, ...[false; 10]];
bool[256] digest = sha256(a, b, c, d, dummyblock1, dummyblock2);
return digest;
}