/ test / contracts / crypto.aes
crypto.aes
 1  include "String.aes"
 2  contract CryptoTest =
 3    entrypoint sha3_str    (s : string) : hash = String.sha3(s)
 4    entrypoint sha256_str  (s : string) : hash = String.sha256(s)
 5    entrypoint blake2b_str (s : string) : hash = String.blake2b(s)
 6  
 7    type complex = list(option(int) * string)
 8  
 9    entrypoint sha3    (x : complex) : hash = Crypto.sha3(x)
10    entrypoint sha256  (x : complex) : hash = Crypto.sha256(x)
11    entrypoint blake2b (x : complex) : hash = Crypto.blake2b(x)
12  
13    entrypoint sha3_b17    (x : bytes(17)) : hash = Crypto.sha3(x)
14    entrypoint sha256_b17  (x : bytes(17)) : hash = Crypto.sha256(x)
15    entrypoint blake2b_b17 (x : bytes(17)) : hash = Crypto.blake2b(x)
16  
17    entrypoint sha3_b52    (x : bytes(52)) : hash = Crypto.sha3(x)
18    entrypoint sha256_b52  (x : bytes(52)) : hash = Crypto.sha256(x)
19    entrypoint blake2b_b52 (x : bytes(52)) : hash = Crypto.blake2b(x)
20  
21    entrypoint sha3_bX    (x : bytes()) : hash = Crypto.sha3(x)
22    entrypoint sha256_bX  (x : bytes()) : hash = Crypto.sha256(x)
23    entrypoint blake2b_bX (x : bytes()) : hash = Crypto.blake2b(x)
24  
25    entrypoint test_verify(msg : bytes(), pk : address, sig : signature) =
26      Crypto.verify_sig(msg, pk, sig)
27  
28    entrypoint test_string_verify(x : string, pk : address, sig : signature) =
29      Crypto.verify_sig(String.sha3(x), pk, sig)
30  
31    entrypoint test_verify_secp256k1(msg : hash, pk : bytes(64), sig : signature) =
32      Crypto.verify_sig_secp256k1(msg, pk, sig)
33  
34    entrypoint test_string_verify_secp256k1(x : string, pk : bytes(64), sig : signature) =
35      Crypto.verify_sig_secp256k1(String.sha3(x), pk, sig)
36  
37    entrypoint test_ecverify_secp256k1(msg : hash, pk : bytes(20), sig : bytes(65)) =
38      Crypto.ecverify_secp256k1(msg, pk, sig)
39  
40    entrypoint test_recover_secp256k1(msg : hash, sig : bytes(65)) =
41      Crypto.ecrecover_secp256k1(msg, sig)
42  
43    entrypoint poseidon(x : int, y : int) : int = Crypto.poseidon(x, y)