Skip to main content

Cryptography

Hash

A hash function maps an bytes value of arbitrary length to a fixed-length bytes value, such that it is not possible to compute the input from a hashed value.

Builtins


Hashes bytes value with blake2b algorithm


Hashes bytes value with keccak algorithm


Hashes bytes value with sha256 algorithm


Hashes bytes value with sha3 algorithm


Hashes bytes value with sha512 algorithm


Signature

An asymetric signature pattern allows the off-chain signing of some data with the the secret key, and check on-chain the identity of the signer with its public key.

Types


Cryptographic signature


Builtins


Checks if signature and data matches


Timelock

A timelocked value is encrypted strongly enough so that it will take more than a certain amount of time to crack it with a powerful computer, but weakly enough so that given some more time, this computer will manage to crack it. That is to say that, beyond a certain amount of time, a timelocked value may be considered public.

Learn more with this contract example.

Types


Timelock encrypted data


Key for chest


Builtins


Decrypt chest data


Sapling

Sapling allows anonymity when transacting with fungible tokens.

Sapling requires a set of additional keys, similar to the public and private keys of your Tezos blockchain wallet. There is the viewing key and sending key. The viewing key is similar to the public key, where it allows you to see private transactions sent in and out. more ...

Types


Sapling state


Sapling transaction


Builtins


Creates sapling state


Applies sapling transaction


Elliptic curves

Elliptic curves provide a fast and efficient asymetric encryption pattern.

Types


Multiplicative scalar for g1 and g2


Point on g1


Point on g2


Builtins


Checks pairing of pairs of BLS values