[Cuis-dev] Adding SHA-256

Casey Ransberger bahweep at icloud.com
Mon May 4 13:06:52 PDT 2020


Quick top post: If we’re replacing a cryptographic function, we should probably make sure we have a crapload of unit tests.

Just a thought.

—Casey

> On May 3, 2020, at 2:22 PM, Philip Bernhart via Cuis-dev <cuis-dev at lists.cuis.st> wrote:
> 
> 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
> -- 
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev



More information about the Cuis-dev mailing list