EthWallet.Utils.Crypto (eth_wallet v0.1.1)

Crypto Lib

Summary

Functions

Link to this function

decrypt_key(encrypted_key, password)

@spec decrypt_key(binary(), binary()) :: binary()
Link to this function

double_sha256(data)

@spec double_sha256(binary()) :: binary()
Link to this function

encrypt_key(unencrypted_key, password)

@spec encrypt_key(binary(), binary()) :: binary()
Link to this function

generate_key_secp256k1()

Link to this function

generate_key_secp256k1(privkey)

Link to this function

pad(data, block_size)

Link to this function

pubkey_to_address(public_key)

Link to this function

recover(digest, signature, recovery_id_handled, chain_id \\ nil)

Link to this function

ripemd160(data)

Link to this function

sign(digest, priv)

:crypto.sign(:ecdsa, :sha256, msg, [privkey, :secp256k1])

equal to

msg |> sha256() |> :libsecp256k1.ecdsa_sign

sig format: 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S]

  • sha256 digest using for bitcoin
Link to this function

sign_compact(digest, privkey, chain_id \\ nil)

The test is here:

https://github.com/exthereum/exth_crypto/blob/master/lib/signature/signature.ex

Attention: hash should be 32 bytes.

Link to this function

verify(digest, sig, pubkey)

The test is here:

https://github.com/exthereum/exth_crypto/blob/master/lib/signature/signature.ex

Attention: hash should be 32 bytes.

Link to this function

verify_compact(digest, sig, pubkey)