17 lines
640 B
Plaintext
17 lines
640 B
Plaintext
import "./1024bit" as sha256;
|
|
|
|
// A function that takes 2 bool[256] arrays as inputs
|
|
// and returns their sha256 full round output as an array of 256 bool.
|
|
def main(bool[256] a, bool[256] b) -> bool[256] {
|
|
|
|
// Hash is computed on the full 512bit block size
|
|
// padding does not fit in the primary block
|
|
// add dummy block (single "1" followed by "0" + total length)
|
|
bool[256] dummyblock1 = [true, ...[false; 255]];
|
|
|
|
// Total length of message is 512 bits: 0b1000000000
|
|
bool[256] dummyblock2 = [...[false; 246], true, ...[false; 9]];
|
|
|
|
bool[256] digest = sha256(a, b, dummyblock1, dummyblock2);
|
|
return digest;
|
|
} |