ethers.js/lib.esm/hash/id.js

17 lines
460 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 { toUtf8Bytes } from "../utils/index.js";
2022-12-10 02:24:58 +03:00
/**
* A simple hashing function which operates on UTF-8 strings to
* compute an 32-byte irentifier.
*
* This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes
* the [[keccak256]].
*
* @example:
* id("hello world")
* //_result:
*/
2022-09-05 23:57:11 +03:00
export function id(value) {
return keccak256(toUtf8Bytes(value));
}
//# sourceMappingURL=id.js.map