@nervosnetwork/ckb-sdk-utils
Version:
Utils module of @nervosnetwork/ckb-sdk-core
11 lines • 473 B
JavaScript
import blake2b from './blake2b.js';
import { hexToBytes } from '../convertors/index.js';
import { PERSONAL } from '../const.js';
export const blake160 = (data, encode = 'binary') => {
const formattedData = typeof data === 'string' ? hexToBytes(data) : data;
const s = blake2b(32, null, null, PERSONAL);
s.update(formattedData);
return s.digest(encode).slice(0, encode === 'binary' ? 20 : 40);
};
export default blake160;
//# sourceMappingURL=blake160.js.map