ExWeb3EcRecover.PersonalType (ex_web3_ec_recover v0.6.0) View Source

This modules implements behaviour described in EIP 191

Check create_hash_from_personal_message/1 for details.

Link to this section Summary

Functions

Creates a has of personal message hash.

Link to this section Functions

Link to this function

create_hash_from_personal_message(message)

View Source

Specs

create_hash_from_personal_message(String.t() | binary()) :: binary()

Creates a has of personal message hash.

If message is a hex string it will parse the string and if it is a binary it it will be encoded directly.

Examples

iex> ExWeb3EcRecover.PersonalType.create_hash_from_personal_message( ...> "hello world" ...> ) <<217, 235, 161, 110, 208, 236, 174, 67, 43, 113, 254, 0, 140, 152, 204, 135, 43, 180, 204, 33, 77, 50, 32, 163, 111, 54, 83, 38, 207, 128, 125, 104>>

iex> ExWeb3EcRecover.PersonalType.create_hash_from_personal_message( ...> "0x0cc175b9c0f1b6a831c399e26977266192eb5ffee6ae2fec3ad71c777531578f" ...> ) <<69, 174, 138, 44, 5, 119, 42, 3, 176, 234, 146, 150, 249, 229, 84, 19, 196,150, 121, 92, 232, 51, 41, 58, 31, 82, 183, 223, 101, 32, 68, 206>>