Crypto
val blake2b : bytes -> bytes
let blake2b: (b: bytes) => bytes
Runs the blake2b hash algorithm
over the given bytes
data and returns a bytes
representing the hash.
let hasherman_blake (s: bytes) : bytes = Crypto.blake2b s
let hasherman_blake = (s: bytes):bytes => Crypto.blake2b(s);
val sha256 : bytes -> bytes
let sha256: (b: bytes) => bytes
Runs the sha256 hash algorithm
over the given bytes
data and returns a bytes
representing the
hash.
let hasherman (s : bytes) : bytes = Crypto.sha256 s
let hasherman = (s: bytes): bytes => Crypto.sha256(s);
val sha512 : bytes -> bytes
let sha512: (b: bytes) => bytes
Runs the sha512 hash algorithm over the given
bytes
data and returns a bytes
representing the hash.
let hasherman512 (s: bytes) : bytes = Crypto.sha512 s
let hasherman512 = (s: bytes): bytes => Crypto.sha512(s);
val sha3 : bytes -> bytes
let sha3: (b: bytes) => bytes
Runs the sha3 hash algorithm over the given
bytes
data and returns a bytes
representing the hash.
let hasherman3 (s: bytes) : bytes = Crypto.sha3 s
let hasherman3 = (s: bytes): bytes => Crypto.sha3(s);
val keccak : bytes -> bytes
let keccak: (b: bytes) => bytes
Runs the keccak over the given
bytes
data and returns a bytes
representing the hash.
let hasherman_keccak (s: bytes) : bytes = Crypto.keccak s
let hasherman_keccak = (s: bytes): bytes => Crypto.keccak(s);
val hash_key : key -> key_hash
let hash_key: (k: key) => key_hash
Hashes a key for easy comparison and storage.
let check_hash_key (kh1, k2: key_hash * key) : bool * key_hash =
let kh2 : key_hash = Crypto.hash_key k2 in
if kh1 = kh2 then (true, kh2) else (false, kh2)
let check_hash_key = (kh1: key_hash, k2: key) : [bool, key_hash] => {
let kh2 : key_hash = Crypto.hash_key(k2);
if (kh1 == kh2) { return [true, kh2]; } else { return [false, kh2]; };
};
val check : key -> signature -> bytes -> bool
let check: (k: key, s: signature, b: bytes) => bool
Check that a message has been signed by a particular key.
⚠️ There is no way to generate a signed message in LIGO. This is because that would require storing a private key on chain, at which point it isn't very private anymore.
let check_signature (pk, signed, msg : key * signature * bytes) : bool =
Crypto.check pk signed msg
function check_signature (pk: key, signed: signature, msg: bytes) : bool {
return Crypto.check(pk, signed, msg)
};