filecoin-project / ref-fvm

Reference implementation of the Filecoin Virtual Machine
https://fvm.filecoin.io/
Other
380 stars 136 forks source link

Perform SHA256 hashes natively via a syscall #636

Closed Stebalien closed 1 year ago

Stebalien commented 2 years ago

HAMTs currently perform SHA256 hashing inside the actors (for hashing HAMT keys). We should be doing this via a syscall.

mriise commented 2 years ago

hash(data: &[u8], mh: Code) ?

Stebalien commented 2 years ago

Yep. We have the syscall defined here: https://github.com/filecoin-project/ref-fvm/blob/923a6846c203ceaed06dd683ccc4ed37dd738c68/fvm/src/syscalls/crypto.rs#L48

However, we'll have to change the HAMT constructor to take a hash function so that the HAMT will work both inside and outside of the FVM.

Stebalien commented 1 year ago

Fixed