ethers.js/lib.esm/hash/message.js

14 lines
459 B
JavaScript
Raw Normal View History

2022-09-16 05:58:45 +03:00
import { keccak256 } from "../crypto/index.js";
2022-09-05 23:57:11 +03:00
import { MessagePrefix } from "../constants/index.js";
import { concat, toUtf8Bytes } from "../utils/index.js";
export function hashMessage(message) {
if (typeof (message) === "string") {
message = toUtf8Bytes(message);
}
return keccak256(concat([
toUtf8Bytes(MessagePrefix),
toUtf8Bytes(String(message.length)),
message
]));
}
//# sourceMappingURL=message.js.map