17 lines
663 B
Plaintext
17 lines
663 B
Plaintext
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;
|
|
} |