0
$\begingroup$

I'm trying to write my own SHA-256 implementation in VHDL, which runs in parallel execution style

I have been using this as a reference to the SHA-256 algorithm: https://www.researchgate.net/file.PostFileLoader.html?id=534b393ad3df3e04508b45ad&assetKey=AS%3A273514844622849%401442222429260

In the hash computation where a, b, c, d, e, f, g, h, T1 and T2 are being calculated for 64 rounds, are these values being computed in parallel or sequentially?

For example, if we take the iteration number at 10 for the value e e = d+T1 Does e take the value of d and T1 from the previous iteration 9, or the value of T1 which was just calculated in this iteration?

Thanks

$\endgroup$

2 Answers 2

2
$\begingroup$

SHA-256 has a basic building block which is not easily paralalized. Between blocks SHA-256 follows a Merkle-Damgard construction and needs to be computed sequentially. You could build a tree-hash using the same compression function, and this will be secure and allow parallel computing but results would not be consistent with the SHA-256 standard.

https://en.wikipedia.org/wiki/Merkle%E2%80%93Damg%C3%A5rd_construction
https://en.wikipedia.org/wiki/Merkle_tree

$\endgroup$
0
$\begingroup$

The algorithm is presented as a sequence of imperative statements, given in the order they are to be executed. So e = d + T_1 uses the value of d from the previous round, and the value of T_1 from the current round.

If it helps, here's my simple Java implementation which follows the spec closely: https://github.com/dlubarov/java-sha/blob/master/src/main/java/ReferenceSha256.java#L104

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.