Version: 0.28.0

Crypto

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 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 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 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 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 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);
if (kh1 == kh2) {
return [true, kh2];
}
else {
return [false, kh2];
};
};
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 => {
return Crypto.check(pk, signed, msg);
};