Review Request: Representationally Independent Hash - Motoko

I’ve been messing around with ICRC3 and needed to do hashing of the transaction entries. I wrote my own library but then found that @nometa had done most of the work in the ic-certification library. I ported over his work, ICRC3ified it a bit, and added a sleb128 function for integers.

I found a few tests in the rust crate: https://github.com/dfinity/response-verification/blob/main/packages/ic-representation-independent-hash/src/representation_independent_hash.rs

…but I probably need some more, especially to test the sleb128 function.

If anyone can give it a quick review I’ll keep searching for tests and, eventually, push it to mops.

cc: @timo, @roman-kashitsyn , @quint , @mariop

1 Like

@skilesare
I have sleb128 encoding in my numbers library
https://mops.one/xtended-numbers
It was done with my candid encoding work
Did some with my ICP.NET work too

I can review yours if you want to roll your own though

3 Likes

Nice! I’ll check it out.

The Sleb function worked like a charm(which is good because mine was not good).

I also added some of the test examples from the ICRC3 pseudo code that @bogwar published here: https://github.com/dfinity/ICRC-1/blob/icrc-3/standards/ICRC-3/HASHINGVALUES.md

(Would love to get that array example to work when we know the proper hash)

The version bumped to 0.1.1.

https://mops.one/rep-indy-hash/versions

1 Like