function ethHashMessage(message): string

Computes the EIP-191 personal-sign message digest to sign.

This prefixes the message with EthMessagePrefix | EthMessagePrefix and the decimal length of message and computes the keccak256 digest.

If message is a string, it is converted to its UTF-8 bytes first. To compute the digest of a DataHexString, it must be converted to bytes.

This is the same as hashMessage except it uses EthMessagePrefix instead of MessagePrefix and is available for broader compatibility with EVM signing practices.

Parameters

ParameterTypeDescription
messagestring | Uint8Array

Returns

string

Source

hash/message.ts:75