2022-09-05 16:57:11 -04:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.ripemd160 = void 0;
|
|
|
|
const ripemd160_1 = require("@noble/hashes/ripemd160");
|
|
|
|
const index_js_1 = require("../utils/index.js");
|
|
|
|
let locked = false;
|
|
|
|
const _ripemd160 = function (data) {
|
|
|
|
return (0, ripemd160_1.ripemd160)(data);
|
|
|
|
};
|
|
|
|
let __ripemd160 = _ripemd160;
|
2022-11-30 15:44:23 -05:00
|
|
|
/**
|
|
|
|
* Compute the cryptographic RIPEMD-160 hash of %%data%%.
|
|
|
|
*
|
2022-12-02 21:27:06 -05:00
|
|
|
* @_docloc: api/crypto:Hash Functions
|
2022-11-30 15:44:23 -05:00
|
|
|
* @returns DataHexstring
|
2022-12-09 18:24:58 -05:00
|
|
|
*
|
|
|
|
* @example:
|
|
|
|
* ripemd160("0x")
|
|
|
|
* //_result:
|
|
|
|
*
|
|
|
|
* ripemd160("0x1337")
|
|
|
|
* //_result:
|
|
|
|
*
|
|
|
|
* ripemd160(new Uint8Array([ 0x13, 0x37 ]))
|
|
|
|
* //_result:
|
|
|
|
*
|
2022-11-30 15:44:23 -05:00
|
|
|
*/
|
2022-09-05 16:57:11 -04:00
|
|
|
function ripemd160(_data) {
|
2022-09-15 22:58:45 -04:00
|
|
|
const data = (0, index_js_1.getBytes)(_data, "data");
|
2022-09-05 16:57:11 -04:00
|
|
|
return (0, index_js_1.hexlify)(__ripemd160(data));
|
|
|
|
}
|
|
|
|
exports.ripemd160 = ripemd160;
|
|
|
|
ripemd160._ = _ripemd160;
|
|
|
|
ripemd160.lock = function () { locked = true; };
|
|
|
|
ripemd160.register = function (func) {
|
|
|
|
if (locked) {
|
|
|
|
throw new TypeError("ripemd160 is locked");
|
|
|
|
}
|
|
|
|
__ripemd160 = func;
|
|
|
|
};
|
|
|
|
Object.freeze(ripemd160);
|
|
|
|
//# sourceMappingURL=ripemd160.js.map
|