23 lines
576 B
Plaintext
23 lines
576 B
Plaintext
|
import "./512bit" as sha256;
|
||
|
|
||
|
// A function that takes a u32[8] array as input, pads it,
|
||
|
// and returns the sha256 output as a u32[8]
|
||
|
def main(u32[8] a) -> u32[8] {
|
||
|
|
||
|
// Hash is computed on 256 bits of input
|
||
|
// padding fits in the remaining 256 bits of the first block
|
||
|
// add dummy block (single "1" followed by "0" + total length)
|
||
|
u32[8] dummyblock1 = [ \
|
||
|
0x80000000,
|
||
|
0x00000000,
|
||
|
0x00000000,
|
||
|
0x00000000,
|
||
|
0x00000000,
|
||
|
0x00000000,
|
||
|
0x00000000,
|
||
|
0x00000100
|
||
|
];
|
||
|
|
||
|
return sha256(a, dummyblock1);
|
||
|
}
|