Renamed nifecrecover->ecrecover

This commit is contained in:
John Newby 2019-08-08 12:55:07 +02:00
parent da9248df2a
commit 9a846201f2
4 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
[package]
name = "nifecrecover"
name = "ecrecover"
version = "0.1.0"
authors = ["John Newby <john@newby.org>"]
edition = "2018"

View File

@ -1,10 +1,10 @@
# ecrecover
FFI export of Ethereum's ecrecover, with Erlang integration.
FFI (NIF) export of Ethereum's ecrecover for use from Erlang.
prerequisite:
### prerequisite:
- a checked out copy of my fork of parity-ethereum (https://github.com/johnsnewby/parity-ethereum) checked out in the same directory this is (i.e. it will be referenced as `../parity-ethereum`)
to compile:
### to compile:
`cargo build`
## Erlang integration
@ -12,8 +12,8 @@ to compile:
The shared library uses NIF. Use the erlang file `sec/nifecrecover.erl` to use this:
```
c("src/nifecrecover").
Decoded = nifecrecover:hexstr_to_bin("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").
nifecrecover:ecrecover(Decoded).
nifecrecover:time_taken_to_execute(fun() -> nifecrecover:ecrecover(Decoded) end).
c("src/ecrecover").
Decoded = ecrecover:hexstr_to_bin("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").
ecrecover:ecrecover(Decoded).
ecrecover:time_taken_to_execute(fun() -> nifecrecover:ecrecover(Decoded) end).
```

View File

@ -1,4 +1,4 @@
-module(nifecrecover).
-module(ecrecover).
%% API
-export([ecrecover/1,
@ -24,7 +24,7 @@ ecrecover_hex(Input) ->
load() ->
erlang:display(file:get_cwd()),
Dir = case code:priv_dir(nifecrecover) of
Dir = case code:priv_dir(ecrecover) of
{error, bad_name} ->
filename:join(
filename:dirname(

View File

@ -19,7 +19,7 @@ mod atoms {
}
rustler_export_nifs!(
"nifecrecover",
"ecrecover",
[
("ecrecover", 1, nif_ecrecover),
],