[Cuis-dev] Adding SHA-256

Phil B pbpublist at gmail.com
Sun May 3 14:44:47 PDT 2020


Philip,

On Sun, May 3, 2020 at 5:23 PM Philip Bernhart via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> 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.
>

Keep in mind that there are a fair number of 32-bit VMs still in use esp.
on ARM.  So ThirtyTwoBitRegister (or something like it) needs to stay in
the mix for a (long) while though there could be a higher performance path
on a 64-bit VM with a fallback to ThirtyTwoBitRegister on 32-bit.


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

Sure, as long as we don't assume that everyone is running on 64-bit
systems.  So you'd want a solution that will scale both for the word size
desired as well as the word size of the VM being run on.


> 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
>

Makes sense to me.


>
>
> Cheers,
> Philip
>
>
Thanks,
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200503/d4e56c6e/attachment.htm>


More information about the Cuis-dev mailing list