* Link to docs in README * Use @polkadot/dev for common tasks * 0.5.0 since docs added
20 lines
619 B
JavaScript
20 lines
619 B
JavaScript
// ISC, Copyright 2017 Jaco Greeff
|
|
// @flow
|
|
|
|
const keccakAsBuffer = require('./asBuffer');
|
|
|
|
/**
|
|
@name keccakAsString
|
|
@signature keccakAsString (value: Buffer | string): string
|
|
@summary Creates a keccak string from the input.
|
|
@description
|
|
From either a `string` or a `Buffer` input, create the keccak and return the result as a non-prefixed string.
|
|
@example
|
|
import { keccakAsString } from '@polkadot/util';
|
|
|
|
console.log('asString', keccakAsString('123')) // => string
|
|
*/
|
|
module.exports = function keccakAsString (value: Buffer | string): string {
|
|
return keccakAsBuffer(value).toString('hex');
|
|
};
|