Renamed nifecrecover->ecrecover
This commit is contained in:
parent
da9248df2a
commit
9a846201f2
@ -1,5 +1,5 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "nifecrecover"
|
name = "ecrecover"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["John Newby <john@newby.org>"]
|
authors = ["John Newby <john@newby.org>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
14
README.md
14
README.md
@ -1,10 +1,10 @@
|
|||||||
# ecrecover
|
# 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`)
|
- 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`
|
`cargo build`
|
||||||
|
|
||||||
## Erlang integration
|
## Erlang integration
|
||||||
@ -12,8 +12,8 @@ to compile:
|
|||||||
The shared library uses NIF. Use the erlang file `sec/nifecrecover.erl` to use this:
|
The shared library uses NIF. Use the erlang file `sec/nifecrecover.erl` to use this:
|
||||||
|
|
||||||
```
|
```
|
||||||
c("src/nifecrecover").
|
c("src/ecrecover").
|
||||||
Decoded = nifecrecover:hexstr_to_bin("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").
|
Decoded = ecrecover:hexstr_to_bin("47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad000000000000000000000000000000000000000000000000000000000000001b650acf9d3f5f0a2c799776a1254355d5f4061762a237396a99a0e0e3fc2bcd6729514a0dacb2e623ac4abd157cb18163ff942280db4d5caad66ddf941ba12e03").
|
||||||
nifecrecover:ecrecover(Decoded).
|
ecrecover:ecrecover(Decoded).
|
||||||
nifecrecover:time_taken_to_execute(fun() -> nifecrecover:ecrecover(Decoded) end).
|
ecrecover:time_taken_to_execute(fun() -> nifecrecover:ecrecover(Decoded) end).
|
||||||
```
|
```
|
@ -1,4 +1,4 @@
|
|||||||
-module(nifecrecover).
|
-module(ecrecover).
|
||||||
|
|
||||||
%% API
|
%% API
|
||||||
-export([ecrecover/1,
|
-export([ecrecover/1,
|
||||||
@ -24,7 +24,7 @@ ecrecover_hex(Input) ->
|
|||||||
|
|
||||||
load() ->
|
load() ->
|
||||||
erlang:display(file:get_cwd()),
|
erlang:display(file:get_cwd()),
|
||||||
Dir = case code:priv_dir(nifecrecover) of
|
Dir = case code:priv_dir(ecrecover) of
|
||||||
{error, bad_name} ->
|
{error, bad_name} ->
|
||||||
filename:join(
|
filename:join(
|
||||||
filename:dirname(
|
filename:dirname(
|
||||||
|
@ -19,7 +19,7 @@ mod atoms {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rustler_export_nifs!(
|
rustler_export_nifs!(
|
||||||
"nifecrecover",
|
"ecrecover",
|
||||||
[
|
[
|
||||||
("ecrecover", 1, nif_ecrecover),
|
("ecrecover", 1, nif_ecrecover),
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user