1.3 KiB
1.3 KiB
keccak
Create Keccak256 values as hex, string & buffer output
- keccakAsBuffer Creates a keccak Buffer from the input.
- keccakAsHex Creates a keccak hex string from the input.
- keccakAsString Creates a keccak string from the input.
keccakAsBuffer
Creates a keccak Buffer from the input.
keccakAsBuffer (value: Buffer | string): Buffer
From either a string or a Buffer input, create the keccak and return the result as a Buffer.
import { keccakAsBuffer } from '@polkadot/util';
console.log('asBuffer', keccakAsBuffer('123')) // => Buffer
keccakAsHex
Creates a keccak hex string from the input.
keccakAsHex (value: Buffer | string): string
From either a string or a Buffer input, create the keccak and return the result as a 0x prefixed hex string.
import { keccakAsHex } from '@polkadot/util';
console.log('asHex', keccakAsHex('123')) // => 0x...
keccakAsString
Creates a keccak string from the input.
keccakAsString (value: Buffer | string): string
From either a string or a Buffer input, create the keccak and return the result as a non-prefixed string.
import { keccakAsString } from '@polkadot/util';
console.log('asString', keccakAsString('123')) // => string