spacemeshos / svm

SVM - Spacemesh Virtual Machine
https://spacemesh.io
MIT License
85 stars 14 forks source link

Implement host function: `svm_hash` #442

Open YaronWittenstein opened 2 years ago

YaronWittenstein commented 2 years ago

We need to settle on one Hash function implementation for now.

Host function signature: svm_hash(start: i32, end: i32, result_ptr: i32)

The function should get as input a Blob of bytes given in the form of:

The svm_hash function will compute the Hash over the Blob of bytes and copy it to Memory starting from the result_ptr given as a parameter.

It's the responsibility of the caller to allocate upfront the Memory to hold the Hash. The caller will know the size of the Hash since it is a constant and known-ahead size.