Files
common/packages/util-crypto/docs/keccak.md
T
Jaco Greeff 03dc89c2b6 Remove exposed Buffer in crypto (#80)
* 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
2018-02-08 16:12:00 +01:00

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
```