RIPEMD-160 builtin
kwxm opened this issue · 2 comments
It's been proposed that the RIPEMD-160 hash function should be added to Plutus Core, and a CIP is currently being prepared.
To do this we'll need to
- Identify a library function that provides the required functionality. This should be audited for safety and a Haskell interface should be provided in
cardano-base
. - Add a new builtin to Plutus Core based on the library function.
- Cost the new function.
- Add a corresponding function to PlutusTx
- Add some tests, including some standard test vectors. We'll want some tests in
plutus-conformance
, and perhaps they should all go there. - Add e2e tests
- Add the new function to
plutus-metatheory
- Add the new function to the Plutus Core specification.
We already have a number of hash functions in Plutus Core and this will be very similar, so it shouldn't be too difficult to add it
Thanks a lot for putting this together @kwxm! Let me add some context to your points:
- Identify a library function that provides the required functionality. This should be audited for safety and a Haskell interface should be provided in
cardano-base
.
The binding which was just added to cardano-base
is based on cryptonite
implementation and I believe that library was already approved as source of cryptographic primitives. Am I right @perturbing?
This new minor release was also published on CHaP so I was able to just bump the CHaP version in cabal.project
and flake.lock
to use it.
- Add a new builtin to Plutus Core based on the library function.
This addition was done in few places: primitive binding, builtin definition, fake cost model params, test case
- Cost the new function.
This is still missing :-(
- Add a corresponding function to PlutusTx
Implemented here
- Add some tests, including some standard test vectors. We'll want some tests in
plutus-conformance
, and perhaps they should all go there.
Implemented in #d7470ca8cc4e664c7e21ec79de1c0a961ad1c6b7
- Add e2e tests
Could you please point me to some examples which I can follow. I'm testing this new builtin in the context of Bitcoin pubkeyhash<->pubkey hash verification so I'm happy to turn this into a test case.
- Add the new function to
plutus-metatheory
I think this is done here: https://github.com/IntersectMBO/plutus/pull/6147/files#diff-0edb07d418229734a515c575977b4866dccdfee4aadeeee116b4dda09999639dR225
- Add the new function to the Plutus Core specification.
Happy to do this by following keccak_256
and blake2b
entries. Could you please point me to a repo/file(s) where it should be added?