Forge v0.5.3 Forge.Crypto View Source

Crypto related functions

Link to this section Summary

Functions

Create a random private key

Create a public key based on private key

Create wallet address based on public key

Sign data with private key

Verify signature with public key

Generate a tendermint tx hash based on tx data

Generate an Ethereum compatible sha3

Link to this section Functions

Link to this function create_private_key() View Source
create_private_key() :: String.t()

Create a random private key

Link to this function create_public_key(private_key) View Source
create_public_key(String.t()) :: String.t()

Create a public key based on private key

Link to this function create_wallet_address(public_key) View Source
create_wallet_address(String.t()) :: String.t()

Create wallet address based on public key

Link to this function ecdsa_sign!(data, arg) View Source
ecdsa_sign!(binary(), binary()) :: binary()

Sign data with private key

Link to this function ecdsa_verify(data, signature, public_key) View Source
ecdsa_verify(binary(), binary(), binary()) :: :ok | :error

Verify signature with public key

Link to this function get_tx_hash(data) View Source
get_tx_hash(String.t()) :: String.t()

Generate a tendermint tx hash based on tx data

iex> Forge.Crypto.get_tx_hash(“hello”) “2CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C”

Generate an Ethereum compatible sha3

iex> Forge.Crypto.sha3(“hello”) <<28, 138, 255, 149, 6, 133, 194, 237, 75, 195, 23, 79, 52, 114, 40, 123, 86, 217, 81, 123, 156, 148, 129, 39, 49, 154, 9, 167, 163, 109, 234, 200>>

iex> Forge.Crypto.sha3(“hello”, :upper) “1C8AFF950685C2ED4BC3174F3472287B56D9517B9C948127319A09A7A36DEAC8”

iex> Forge.Crypto.sha3(“hello”, :lower) “1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8”

Link to this function sha3(data, atom) View Source
sha3(binary(), :upper | :lower) :: binary()