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

34 lines
852 B
Plaintext
Executable File

import "./1536bit" as sha256;
// A function that takes four u32[8] array as input, concatenates them, pads the result,
// and returns the sha256 output as a u32[8]
def main(u32[8] a, u32[8] b, u32[8] c, u32[8] d) -> u32[8] {
// 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)
u32[8] dummyblock1 = [ \
0x80000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000
];
u32[8] dummyblock2 = [ \
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000000,
0x00000400
];
return sha256(a, b, c, d, dummyblock1, dummyblock2);
}