1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00
ZoKrates/zokrates_stdlib/stdlib/hashes/sha256/embed/256bitPadded.zok
2021-07-16 13:19:57 +02:00

13 lines
No EOL
510 B
Text

import "./512bit" as sha256
// A function that takes 1 bool[256] array as input
// and returns the sha256 full round output as an array of 256 bool.
def main(bool[256] a) -> (bool[256]):
// Hash is computed on 256 bits of input
// padding fits in the remaining 256 bits of the first block
// add dummy block (single "true" followed by "false" + total length)
bool[256] dummyblock1 = [true, ...[false; 246], true, ...[false; 8]]
bool[256] digest = sha256(a, dummyblock1)
return digest