Another week has passed (fifth) and my work on SHA1 is coming to an end. I’m right now before the testing phase which would be hopefully done by the end of the day.

Summing up all my struggles with SHA1 I have to say it was more difficult than I assumed it to be initially. Of course algorithm itself is really easy (after all it’s just a few summations and XOR operations) but the thing that makes it non-trivial is trying to minimize resources used which in turn create synchronization problems and this, if not done properly, may decrease the overall speed. As an example:

The algorithm takes 512b of actual data and by manipulating it (XORing together different 32b pieces) creates another 4 blocks 512b each. Our module has only enough RAM to store one such block (512b instead of 2560b) so the procedure of generating new data has to be done in such a way that it is ready when algorithm needs it, but not too fast so that old data which haven’t been used yet are not overwritten. How to do it avoiding unnecessary wait states?

Another issue comes from the fact our design uses only one adder. Because of that, the time complexity becomes basically summation dependent. It is crucial then, to utilize the adder every clock cycle.

As for the next week, I will start working on an encryption algorithm RC4 or AES128 (it has to be decided yet which one).