How to use the @polkadot/util-crypto.keccakAsU8a function in @polkadot/util-crypto

To help you get started, we’ve selected a few @polkadot/util-crypto examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github polkadot-js / client / packages / client-runtime / src / crypto / index.ts View on Github external
instrument('keccak_256', (): void => {
        const data = heap.get(dataPtr, dataLen);
        const hash = keccakAsU8a(data);

        l.debug((): any[] => ['keccak_256', [dataPtr, dataLen, outPtr], '<-', u8aToHex(data), '->', u8aToHex(hash)]);

        heap.set(outPtr, hash);
      }),
    // eslint-disable-next-line @typescript-eslint/camelcase
github ChainSafe / ssz-js / src / index.js View on Github external
function hash (x) {
  return Buffer.from(keccakAsU8a(x))
}
github ChainSafe / lodestar / src / chain / helpers / stateTransitionHelpers.ts View on Github external
export function hash(value: bytes): bytes32 {
  return Buffer.from(keccakAsU8a(value));
}
github polkadot-js / apps / packages / app-claims / src / util.ts View on Github external
export function hashMessage (message: string): Buffer {
  const expanded = stringToU8a(`\x19Ethereum Signed Message:\n${message.length.toString()}${message}`);
  const hashed = keccakAsU8a(expanded);

  return u8aToBuffer(hashed);
}