2019-08-20 14:37:55 +02:00
2019-08-07 12:59:41 +02:00
2019-08-06 15:33:27 +02:00
2019-08-19 17:27:21 +02:00
2019-08-20 14:37:55 +02:00
2019-08-15 09:28:29 +02:00
2019-08-20 14:37:55 +02:00
2019-08-15 12:55:08 +02:00
2019-08-20 14:36:38 +02:00
2019-08-20 14:37:06 +02:00
2019-08-20 14:37:06 +02:00

ecrecover

FFI (NIF) export of Ethereum's ecrecover for use from Erlang.

prerequisite:

to compile:

cargo build

Erlang integration

The shared library uses NIF. Use the erlang file src/ecrecover.erl to use this:

c("src/ecrecover").
c("src/ecrecover_util").
Decoded = ecrecover_util:hex_to_bin("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").
List = binary:bin_to_list(Decoded).
Hash = binary:list_to_bin(lists:sublist(List, 1, 32)).
Sig = binary:list_to_bin(lists:sublist(List, 64, 65)).
Input = <<Hash/binary, 0:(8*31), Sig/binary>>.
binary:bin_to_list(Input) == binary:bin_to_list(Decoded).
Result = ecrecover:recover(Hash, Sig).
Expected = ecrecover_util:hex_to_bin("000000000000000000000000c08b5542d177ac6686946920409741463a15dddb").
binary:bin_to_list(Result) == binary:bin_to_list(Expected). %% check result
Description
No description provided
Readme 1.8 MiB
Languages
Erlang 58.5%
C 30.3%
Nix 4.9%
Shell 3.7%
Makefile 2.6%