1
0
Fork 0
mirror of synced 2025-09-23 12:18:44 +00:00
ZoKrates/zokrates_stdlib/stdlib/hashes/sha256/1024bitPadded.zok
2020-07-03 18:10:33 +02:00

31 lines
821 B
Text

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(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)