* Use js-sha3 instead of keccak * Remove exposed toBuffer from util-crypto * Add definiton for js-sha3 * Remove Buffer from docs * Cleanup crypto hashing * Cleanup interface
40 lines
895 B
Markdown
40 lines
895 B
Markdown
# keccak
|
|
|
|
Create Keccak256 values as hex & Uint8Array output
|
|
|
|
- [keccakAsHex](#keccakashex) Creates a keccak hex string from the input.
|
|
- [keccakAsU8a](#keccakasu8a) Creates a keccak Uint8Array from the input.
|
|
|
|
## keccakAsHex
|
|
|
|
Creates a keccak hex string from the input.
|
|
|
|
```js
|
|
keccakAsHex (value: Buffer | Uint8Array | string): string
|
|
```
|
|
|
|
|
|
From either a `string` or a `Buffer` input, create the keccak and return the result as a `0x` prefixed hex string.
|
|
|
|
```js
|
|
import { keccakAsHex } from '@polkadot/util-crypto';
|
|
|
|
keccakAsHex('123') // => 0x...
|
|
```
|
|
|
|
## keccakAsU8a
|
|
|
|
Creates a keccak Uint8Array from the input.
|
|
|
|
```js
|
|
keccakAsU8a (value: Buffer | Uint8Array | string): Uint8Array
|
|
```
|
|
|
|
|
|
From either a `string` or a `Buffer` input, create the keccak and return the result as a `Uint8Array`.
|
|
|
|
```js
|
|
import { keccakAsU8a } from '@polkadot/util-crypto';
|
|
|
|
keccakAsU8a('123') // => Uint8Array
|
|
``` |