Skip to content

Hashing functions

All hashing functions take a sp.bytes value and return the corresponding hash as a new sp.bytes 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.

sp.blake2b(bytes) → sp.bytes
smartpy
some_bytes = sp.pack("A String")
hash = sp.blake2b(some_bytes)
sp.sha512(bytes) → sp.bytes
smartpy
some_bytes = sp.pack("A String")
hash = sp.sha512(some_bytes)
sp.sha256(bytes) → sp.bytes
smartpy
some_bytes = sp.pack("A String")
hash = sp.sha256(some_bytes)
sp.sha3(bytes) → sp.bytes
smartpy
some_bytes = sp.pack("A String")
hash = sp.sha3(some_bytes)
sp.keccak(bytes) → sp.bytes
smartpy
some_bytes = sp.pack("A String")
hash = sp.keccak(some_bytes)