mpizenberg / elm-cardano

Elm offchain package for Cardano
BSD 3-Clause "New" or "Revised" License
7 stars 2 forks source link

Add BLAKE2-b hash support #31

Open mpizenberg opened 3 weeks ago

mpizenberg commented 3 weeks ago

I’m currently implementing some cryptographic constructs while following an online course on the subject. I’ve written a BLAKE2-b implementation in Roc (https://github.com/mpizenberg/crypto-0-to-hero/blob/c5857cfc7900d7346e7174ecfae6261af7dde2e8/07-blake2b.roc), which is similar to elm as a language. So it would be nice to adapt that in elm for elm-cardano.

It’s a rather well defined task so I guess any motivated contributor could have a try at it.

mpizenberg commented 3 weeks ago

The main difficulty is probably around the fact that we don’t have fixed size integers in Elm. So some work is probably needed to figure out the most convenient way of handling this. Use elm Int (beware that it’s not 64bit integers, but JS numbers under the hood), use something like elm-natural (https://elm.dmy.fr/packages/dwayne/elm-natural/latest/) doesn’t have fixed size integers either. Use something like Bytes? It’s not super flexible but maybe the best for making it an independant elm package. Use the bytes type inside elm-cardano? It’s based on hex strings under the hood, because that’s the best option for elm-cardano.