Skip to content
On this page

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
someBytes = sp.pack("A String")

hash = sp.blake2b(someBytes)
Michelson BLAKE2B

sha512 โ€‹

sp.sha512(<bytes>)

python
someBytes = sp.pack("A String")

hash = sp.sha512(someBytes)
Michelson SHA512

sha256 โ€‹

sp.sha256(<bytes>)

python
someBytes = sp.pack("A String")

hash = sp.sha256(someBytes)
Michelson SHA256

sha3 โ€‹

sp.sha3(<bytes>)

python
someBytes = sp.pack("A String")

hash = sp.sha3(someBytes)
Michelson SHA3

keccak โ€‹

sp.keccak(<bytes>)

python
someBytes = sp.pack("A String")

hash = sp.keccak(someBytes)
Michelson KECCAK