Add tslint (#151)
This commit is contained in:
@@ -5,16 +5,16 @@
|
||||
import blake2bAsHex from './blake2b/asHex';
|
||||
|
||||
/**
|
||||
@name blake2AsHex
|
||||
@signature blake2AsHex (data: Uint8Array, bitLenght: number = 256): string
|
||||
@summary Creates a blake2b hex from the input.
|
||||
@description
|
||||
From a `Uint8Array` input, create the blake2b and return the result as a hex string with the specified `bitLength`.
|
||||
@example
|
||||
import { blake2AsHex } from '@polkadot/util-crypto';
|
||||
|
||||
blake2AsHex('abc') // => 0xba80a53f981c4d0d
|
||||
*/
|
||||
* @name blake2AsHex
|
||||
* @signature blake2AsHex (data: Uint8Array, bitLenght: number = 256): string
|
||||
* @summary Creates a blake2b hex from the input.
|
||||
* @description
|
||||
* From a `Uint8Array` input, create the blake2b and return the result as a hex string with the specified `bitLength`.
|
||||
* @example
|
||||
* import { blake2AsHex } from '@polkadot/util-crypto';
|
||||
*
|
||||
* blake2AsHex('abc') // => 0xba80a53f981c4d0d
|
||||
*/
|
||||
export default function blake2AsHex (data: Uint8Array, bitLength: number = 256): string {
|
||||
return blake2bAsHex(data, bitLength);
|
||||
}
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
import blake2bAsU8a from './blake2b/asU8a';
|
||||
|
||||
/**
|
||||
@name blake2AsU8a
|
||||
@signature blake2AsU8a (data: Uint8Array, bitLenght: number = 256): Uint8Array
|
||||
@summary Creates a blake2b u8a from the input.
|
||||
@description
|
||||
From a `Uint8Array` input, create the blake2b and return the result as a u8a with the specified `bitLength`.
|
||||
@example
|
||||
import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
blake2AsU8a('abc') // => [0xba, 0x80, 0xa53, 0xf98, 0x1c, 0x4d, 0x0d]
|
||||
*/
|
||||
* @name blake2AsU8a
|
||||
* @signature blake2AsU8a (data: Uint8Array, bitLenght: number = 256): Uint8Array
|
||||
* @summary Creates a blake2b u8a from the input.
|
||||
* @description
|
||||
* From a `Uint8Array` input, create the blake2b and return the result as a u8a with the specified `bitLength`.
|
||||
* @example
|
||||
* import { blake2AsU8a } from '@polkadot/util-crypto';
|
||||
*
|
||||
* blake2AsU8a('abc') // => [0xba, 0x80, 0xa53, 0xf98, 0x1c, 0x4d, 0x0d]
|
||||
*/
|
||||
export default function blake2AsU8a (data: Uint8Array, bitLength: number = 256, key?: Uint8Array): Uint8Array {
|
||||
return blake2bAsU8a(data, bitLength, key);
|
||||
}
|
||||
|
||||
@@ -6,16 +6,16 @@ import u8aToHex from '@polkadot/util/u8a/toHex';
|
||||
import blake2bAsU8a from './asU8a';
|
||||
|
||||
/**
|
||||
@name blake2bAsHex
|
||||
@signature blake2bAsHex (value: Uint8Array): string
|
||||
@summary Creates a blake2b hex string from the input.
|
||||
@description
|
||||
From a `Uint8Array` input, create the blake2b and return the result as a hex string.
|
||||
@example
|
||||
import { blake2bAsHex } from '@polkadot/util-crypto';
|
||||
|
||||
blake2bAsHex('abc') // => '0xba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923'
|
||||
*/
|
||||
* @name blake2bAsHex
|
||||
* @signature blake2bAsHex (value: Uint8Array): string
|
||||
* @summary Creates a blake2b hex string from the input.
|
||||
* @description
|
||||
* From a `Uint8Array` input, create the blake2b and return the result as a hex string.
|
||||
* @example
|
||||
* import { blake2bAsHex } from '@polkadot/util-crypto';
|
||||
*
|
||||
* blake2bAsHex('abc') // => '0xba80a53f981c4d0d6a2797b69f12f6e94c212f14685ac4b74b12bb6fdbffa2d17d87c5392aab792dc252d5de4533cc9518d38aa8dbf1925ab92386edd4009923'
|
||||
*/
|
||||
export default function blake2bAsHex (data: Uint8Array, bitLength: number = 512): string {
|
||||
return u8aToHex(
|
||||
blake2bAsU8a(data, bitLength)
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
import blakejs from 'blakejs';
|
||||
|
||||
/**
|
||||
@name blake2bAsU8a
|
||||
@signature blake2bAsU8a (value: Uint8Array): Uint8Array
|
||||
@summary Creates a blake2b Uint8Array from the input.
|
||||
@description
|
||||
From a `Uint8Array` input, create the blake2b and return the result as a `Uint8Array`.
|
||||
@example
|
||||
import { blake2bAsU8a } from '@polkadot/util-crypto';
|
||||
|
||||
blake2bAsU8a('abc') // => Uint8Array('508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982')
|
||||
*/
|
||||
* @name blake2bAsU8a
|
||||
* @signature blake2bAsU8a (value: Uint8Array): Uint8Array
|
||||
* @summary Creates a blake2b Uint8Array from the input.
|
||||
* @description
|
||||
* From a `Uint8Array` input, create the blake2b and return the result as a `Uint8Array`.
|
||||
* @example
|
||||
* import { blake2bAsU8a } from '@polkadot/util-crypto';
|
||||
*
|
||||
* blake2bAsU8a('abc') // => Uint8Array('508c5e8c327c14e2e1a72ba34eeb452f37458b209ed63a294d999b4c86675982')
|
||||
*/
|
||||
export default function blake2bAsU8a (data: Uint8Array, bitLength: number = 512, key: Uint8Array | null = null): Uint8Array {
|
||||
return blakejs.blake2b(data, key, bitLength / 8);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import blake2bAsHex from './asHex';
|
||||
import blake2bAsU8a from './asU8a';
|
||||
|
||||
/**
|
||||
@summary Create [Blake2b](https://blake2.net/) values as hex & Uint8Array output
|
||||
*/
|
||||
* @summary Create [Blake2b](https://blake2.net/) values as hex & Uint8Array output
|
||||
*/
|
||||
export {
|
||||
blake2bAsHex,
|
||||
blake2bAsU8a
|
||||
|
||||
@@ -6,8 +6,8 @@ import blake2AsHex from './asHex';
|
||||
import blake2AsU8a from './asU8a';
|
||||
|
||||
/**
|
||||
@summary Create blake2b values with specified bitlengths
|
||||
*/
|
||||
* @summary Create blake2b values with specified bitlengths
|
||||
*/
|
||||
export {
|
||||
blake2AsHex,
|
||||
blake2AsU8a
|
||||
|
||||
Reference in New Issue
Block a user