Add Crypto.ecverify

This commit is contained in:
Hans Svensson 2019-01-21 14:20:15 +01:00
parent 90e45e63d4
commit d8fff8f20f
2 changed files with 10 additions and 2 deletions

View File

@ -148,12 +148,14 @@ global_env() ->
{["Map", "delete"], Fun([K, Map(K, V)], Map(K, V))},
{["Map", "member"], Fun([K, Map(K, V)], Bool)},
{["Map", "size"], Fun1(Map(K, V), Int)},
%% Crypto/Curve operations
{["Crypto", "ecverify"], Fun([Hash, Address, SignId], Bool)},
%% Strings
{["String", "length"], Fun1(String, Int)},
{["String", "concat"], Fun([String, String], String)},
{["String", "sha3"], Fun1(String, Int)},
{["String", "sha3"], Fun1(String, Hash)},
%% Conversion
{["Int", "to_str"], Fun1(Int, String)},
{["Int", "to_str"], Fun1(Int, String)},
{["Address", "to_str"], Fun1(Address, String)}
].

View File

@ -316,6 +316,12 @@ ast_body({map, _, Map, [Upd]}, Icode) ->
ast_body({map, Ann, Map, [Upd | Upds]}, Icode) ->
ast_body({map, Ann, {map, Ann, Map, [Upd]}, Upds}, Icode);
%% Crypto
ast_body(?qid_app(["Crypto", "ecverify"], [Msg, PK, Sig], _, _), Icode) ->
prim_call(?PRIM_CALL_CRYPTO_ECVERIFY, #integer{value = 0},
[ast_body(Msg, Icode), ast_body(PK, Icode), ast_body(Sig, Icode)],
[word, word, sign_t()], word);
%% Strings
%% -- String length
ast_body(?qid_app(["String", "length"], [String], _, _), Icode) ->