[Cuis-dev] Adding SHA-256

Philip Bernhart philip.bernhart at posteo.de
Sun May 3 14:22:11 PDT 2020


Hi folks,

I added an implementation of the SHA-256 algorithm which
belongs to the SHA2 suite of hashing algorithms.

Here is the pull request:
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/pull/166

It has almost the form of the SHA1 implementation, besides that
it doesn't use any special primitives for speed.

What I have noticed is that the SHA1 implementation is a bit dated
as it depends on the ThirtyTwoBitRegister, which tries to mimic a
32bit register (duh!) and which internally still uses two 16bit
SmallIntegers to hold its high and low word. Currently a good
amount of systems out there support 64bit and as the VM is running
on them it has 64bit words and can hold 32bit in one SmallInteger.

So this Register mechanism IMHO could be refactored and it should
also be generalized to have a register implementation for variable
sized registers.

Why?
1. There are other hashing algorithms, which use 64bit registers, why
   re-inventing the wheel for them?

2. A register data structure could be handy for implementing VMs


Cheers,
Philip


More information about the Cuis-dev mailing list