Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@polkadot/util-crypto

Package Overview
Dependencies
Maintainers
1
Versions
1357
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polkadot/util-crypto - npm Package Compare versions

Comparing version 0.13.2 to 0.13.3

blake2/asHex.js

6

index.js

@@ -12,3 +12,5 @@ 'use strict';

// of the ISC license. See the LICENSE file for details.
var blake2 = require('./blake2');
var blake2s = require('./blake2s');
var blake2b = require('./blake2b');
var keccak = require('./keccak');

@@ -19,2 +21,4 @@ var nacl = require('./nacl');

var xxhash = require('./xxhash');
var xxhash32 = require('./xxhash32');
var xxhash64 = require('./xxhash64');

@@ -24,2 +28,2 @@ /**

*/
module.exports = (0, _assign2.default)({}, blake2s, keccak, nacl, random, sha512, xxhash);
module.exports = (0, _assign2.default)({}, blake2, blake2b, blake2s, keccak, nacl, random, sha512, xxhash, xxhash32, xxhash64);

2

package.json
{
"name": "@polkadot/util-crypto",
"version": "0.13.2",
"version": "0.13.3",
"description": "A collection of useful crypto utilities for @polkadot",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,17 +8,27 @@ 'use strict';

var xxhashAsValue = require('./asValue');
var xxhash64AsRaw = require('../xxhash64/asRaw');
/**
@name xxhashAsHex
@signature xxhashAsHex (data: Buffer | Uint8Array | string, seed: number): string
@summary Creates a xxhash hex from the input.
@signature xxhashAsHex (data: Buffer | Uint8Array | string, bitLenght: number = 64): string
@summary Creates a xxhash64 hex from the input.
@description
From either a `string`, `Uint8Array` or a `Buffer` input, create the xxhash and return the result as a hex string.
From either a `string`, `Uint8Array` or a `Buffer` input, create the xxhash64 and return the result as a hex string with the specified `bitLength`.
@example
import { xxhashAsHex } from '@polkadot/util-crypto';
xxhashAsHex('abcd', 0xabcd)) // => 0xcda8fae4
xxhashAsHex('abc')) // => 0x44bc2cf5ad770999
*/
module.exports = function xxhashAsHex(data, seed) {
return hexAddPrefix(xxhashAsValue(data, seed).toString(16));
module.exports = function xxhashAsHex(data) {
var bitLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 64;
var strLength = Math.ceil(bitLength / 4);
var iterations = Math.ceil(strLength / 8);
var result = xxhash64AsRaw(data, 0);
for (var seed = 1; seed < iterations; seed++) {
result += xxhash64AsRaw(data, seed);
}
return hexAddPrefix(result.substr(0, strLength));
};

@@ -6,13 +6,13 @@ 'use strict';

// of the ISC license. See the LICENSE file for details.
var xxhashAsBn = require('./asBn');
var xxhashAsHex = require('./asHex');
var xxhashAsNumber = require('./asNumber');
var xxhashAsHex128 = require('./asHex128');
var xxhashAsHex256 = require('./asHex256');
/**
@summary Create [XXHash](http://cyan4973.github.io/xxHash/) values as BN, hex & number output
@summary Create xxhash64 values with specified bitlengths
*/
module.exports = {
xxhashAsBn: xxhashAsBn,
xxhashAsHex: xxhashAsHex,
xxhashAsNumber: xxhashAsNumber
xxhashAsHex128: xxhashAsHex128,
xxhashAsHex256: xxhashAsHex256
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc