id.js 602 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.id = void 0;
  4. const index_js_1 = require("../crypto/index.js");
  5. const index_js_2 = require("../utils/index.js");
  6. /**
  7. * A simple hashing function which operates on UTF-8 strings to
  8. * compute an 32-byte identifier.
  9. *
  10. * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes
  11. * the [[keccak256]].
  12. *
  13. * @example:
  14. * id("hello world")
  15. * //_result:
  16. */
  17. function id(value) {
  18. return (0, index_js_1.keccak256)((0, index_js_2.toUtf8Bytes)(value));
  19. }
  20. exports.id = id;
  21. //# sourceMappingURL=id.js.map