@liquality/crypto
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
@@ -47,2 +47,2 @@ /// <reference types="node" /> | ||
*/ | ||
bech32, sha256, ripemd160, hash160, ensureBuffer, padHexStart, isHex, }; | ||
bech32, sha256, ripemd160, hash160, ensureBuffer, padHexStart, isHex }; |
@@ -1,1 +0,1 @@ | ||
declare module 'crypto-hashing' | ||
declare module 'crypto-hashing' |
@@ -5,3 +5,3 @@ import cryptoHash from 'crypto-hashing' | ||
function isHex (hex: string) { | ||
function isHex(hex: string) { | ||
if (!hex.match(/([0-9]|[a-f])/gim)) return false | ||
@@ -19,3 +19,3 @@ | ||
*/ | ||
function ensureBuffer (message: string | Buffer | any) { | ||
function ensureBuffer(message: string | Buffer | any) { | ||
if (Buffer.isBuffer(message)) return message | ||
@@ -41,3 +41,3 @@ | ||
*/ | ||
function hashToHex (algorithm: string, message: string | Buffer) { | ||
function hashToHex(algorithm: string, message: string | Buffer) { | ||
return cryptoHash(algorithm, ensureBuffer(message)).toString('hex') | ||
@@ -51,3 +51,3 @@ } | ||
*/ | ||
function hash160 (message: Buffer) { | ||
function hash160(message: Buffer) { | ||
return hashToHex('hash160', message) | ||
@@ -61,3 +61,3 @@ } | ||
*/ | ||
function sha256 (message: string | Buffer) { | ||
function sha256(message: string | Buffer) { | ||
return hashToHex('sha256', message) | ||
@@ -71,3 +71,3 @@ } | ||
*/ | ||
function ripemd160 (message : string | Buffer) { | ||
function ripemd160(message: string | Buffer) { | ||
return hashToHex('ripemd160', message) | ||
@@ -83,3 +83,3 @@ } | ||
*/ | ||
function padHexStart (hex: string, lengthBytes?: number) { | ||
function padHexStart(hex: string, lengthBytes?: number) { | ||
let lengthString = lengthBytes * 2 || hex.length | ||
@@ -96,3 +96,2 @@ lengthString += lengthString % 2 | ||
base58, | ||
/** | ||
@@ -104,3 +103,2 @@ * Get bech32 of message. | ||
bech32, | ||
sha256, | ||
@@ -111,3 +109,3 @@ ripemd160, | ||
padHexStart, | ||
isHex, | ||
isHex | ||
} |
{ | ||
"name": "@liquality/crypto", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "", | ||
@@ -43,3 +43,3 @@ "module": "dist/index.js", | ||
"sideEffects": false, | ||
"gitHead": "3d49c75c41fd288e1ad3b19174f863d82826936a" | ||
"gitHead": "b07f5230045ce027c75028dc3cfd3b26838a6fa2" | ||
} |
# `@liquality/crypto` <img align="right" src="https://raw.githubusercontent.com/liquality/chainabstractionlayer/master/liquality-logo.png" height="80px" /> | ||
[![Build Status](https://travis-ci.com/liquality/chainabstractionlayer.svg?branch=master)](https://travis-ci.com/liquality/chainabstractionlayer) | ||
@@ -16,6 +15,4 @@ [![Coverage Status](https://coveralls.io/repos/github/liquality/chainabstractionlayer/badge.svg?branch=master)](https://coveralls.io/github/liquality/chainabstractionlayer?branch=master) | ||
Query different blockchains with account management using a single and simple interface. | ||
## Installation | ||
@@ -35,21 +32,10 @@ | ||
## Usage | ||
```js | ||
import { | ||
base58, | ||
bech32, | ||
sha256, | ||
ripemd160, | ||
hash160, | ||
ensureBuffer, | ||
padHexStart, | ||
isHex | ||
} from '@liquality/crypto' | ||
import { base58, bech32, sha256, ripemd160, hash160, ensureBuffer, padHexStart, isHex } from '@liquality/crypto' | ||
``` | ||
## License | ||
[MIT](../../LICENSE.md) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
161
0
39645
40