Learn about the hashMessage
utils method
Introduction
The hashMessage
method provides the ability to hash a message using the Keccak-256 hash function. This method takes a message input and returns the hashed value of the message in hexadecimal format.
Usage
This method is useful for creating unique signatures for a given message and verifying the authenticity of the messages. The message can be any string or byte string, and the hashed result is always fixed for a given message.
Here is an example of using the hashMessage
method in Alchemy SDK:
const { Utils } = require("alchemy-sdk");
let message = 'Hello, world!';
let hashedMessage = Utils.hashMessage(message);
console.log(hashedMessage); // 0xb453bd4e271eed985cbab8231da609c4ce0a9cf1f763b6c1594e76315510e0f1