Hashing functions โ
All hashing functions take a sp.TBytes value and return the corresponding hash as a new sp.TBytes value.
See reference Hash Functions template.
To get the bytes associated to a given value you need to use sp.pack(<value>)
. Have a look at Pack and Unpack for more information.
blake2b โ
sp.blake2b(<bytes>)
python
Michelson BLAKE2BsomeBytes = sp.pack("A String")
hash = sp.blake2b(someBytes)
sha512 โ
sp.sha512(<bytes>)
python
Michelson SHA512someBytes = sp.pack("A String")
hash = sp.sha512(someBytes)
sha256 โ
sp.sha256(<bytes>)
python
Michelson SHA256someBytes = sp.pack("A String")
hash = sp.sha256(someBytes)
sha3 โ
sp.sha3(<bytes>)
python
Michelson SHA3someBytes = sp.pack("A String")
hash = sp.sha3(someBytes)
keccak โ
sp.keccak(<bytes>)
python
Michelson KECCAKsomeBytes = sp.pack("A String")
hash = sp.keccak(someBytes)