ethers.js/lib.commonjs/hash/id.js

21 lines
602 B
JavaScript
Raw Permalink Normal View History

2022-09-05 16:57:11 -04:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.id = void 0;
2022-09-15 22:58:45 -04:00
const index_js_1 = require("../crypto/index.js");
const index_js_2 = require("../utils/index.js");
2022-12-09 18:24:58 -05: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 16:57:11 -04:00
function id(value) {
2022-09-15 22:58:45 -04:00
return (0, index_js_1.keccak256)((0, index_js_2.toUtf8Bytes)(value));
2022-09-05 16:57:11 -04:00
}
exports.id = id;
//# sourceMappingURL=id.js.map