Files
pezkuwi-api/packages/bizinikiwi-bindings/dist/esm/hashes/twoX.mjs
T
pezkuwichain 31467f90d4 feat: add PAPI rebrand packages
- @pezkuwi/papi-utils (rebrand of @polkadot-api/utils)
- @pezkuwi/bizinikiwi-bindings (rebrand of @polkadot-api/substrate-bindings)
- @pezkuwi/metadata-builders (rebrand of @polkadot-api/metadata-builders)
- @pezkuwi/merkleize-metadata (rebrand of @polkadot-api/merkleize-metadata)

All @polkadot-api references replaced with @pezkuwi equivalents.
2026-01-22 15:40:12 +03:00

25 lines
788 B
JavaScript

import { mergeUint8 } from '@pezkuwi/papi-utils';
import { u64 } from 'scale-ts';
import { h64 } from './h64.mjs';
const Twox128 = (input) => {
const result = new Uint8Array(16);
const dv = new DataView(result.buffer);
dv.setBigUint64(0, h64(input), true);
dv.setBigUint64(8, h64(input, 1n), true);
return result;
};
const Twox256 = (input) => {
const result = new Uint8Array(32);
const dv = new DataView(result.buffer);
dv.setBigUint64(0, h64(input), true);
dv.setBigUint64(8, h64(input, 1n), true);
dv.setBigUint64(16, h64(input, 2n), true);
dv.setBigUint64(24, h64(input, 3n), true);
return result;
};
const Twox64Concat = (encoded) => mergeUint8([u64.enc(h64(encoded)), encoded]);
export { Twox128, Twox256, Twox64Concat };
//# sourceMappingURL=twoX.mjs.map