Skip to content
On this page

hashMessage

Calculates an Ethereum-specific hash in EIP-191 format: keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)).

Import

ts
import { hashMessage } from 'viem'

Usage

ts
import { hashMessage } from 'viem'

hashMessage('hello world') 
// 0xd9eba16ed0ecae432b71fe008c98cc872bb4cc214d3220a36f365326cf807d68

Returns

Hex

The hashed message.

Parameters

message

Message to hash.

  • Type: string

Released under the MIT License.