mpizenberg / elm-cardano

Elm offchain package for Cardano
https://elm-doc-preview.netlify.app/Cardano?repo=mpizenberg%2Felm-cardano&version=elm-doc-preview
BSD 3-Clause "New" or "Revised" License
11 stars 3 forks source link

Add BLAKE2-b #39

Closed keyan-m closed 1 week ago

keyan-m commented 1 month ago

Addressing #31.

mpizenberg commented 1 month ago

Awesome! don’t hesitate to draft your thinking process in this PR comments so that we can follow on your progress

mpizenberg commented 1 month ago

Nice, this is getting close to finish :)

keyan-m commented 1 month ago

Seems like representing a U64 with two U32 integers is not the best idea. elm-uint64 uses a U16 and two U24 integers, and also seems to leverage Float for some of its operations.

Since elm-uint64 is unmaintained, and that we need U128 multiplication, I'm considering making a minimal copy, and to see whether this approach can be extended to U128.

mpizenberg commented 1 month ago

Makes sense, because to detect multiplication overflow, you’d need to stay within the Int safe range, which is 2^53. So half of this would be 2^26. And I guess 24 is more optimal because a multiple of 8.

mpizenberg commented 2 weeks ago

Exciting to see all these tests passing :)

I’ve fixed all of the elm-review errors on the main branch, so I just merged it here to have it up-to-date (merge will be squashed anyway).

So once you are done with the code, have a look at the elm-review errors.

mpizenberg commented 1 week ago

Amazing! At some point it will be worth extracting this to its own package like https://github.com/folkertdev/elm-sha2 for example. But that is work for another time ^^