Socket
Socket
Sign inDemoInstall

loader-utils

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loader-utils - npm Package Compare versions

Comparing version 3.1.0 to 3.1.1

lib/hash/BatchedHash.js

38

lib/getHashDigest.js

@@ -48,5 +48,7 @@ "use strict";

let createMd4 = undefined;
let BatchedHash = undefined;
let BulkUpdateDecorator = undefined;
function getHashDigest(buffer, hashType, digestType, maxLength) {
hashType = hashType || "xxhash64";
function getHashDigest(buffer, algorithm, digestType, maxLength) {
algorithm = algorithm || "xxhash64";
maxLength = maxLength || 9999;

@@ -56,9 +58,13 @@

if (hashType === "xxhash64") {
if (algorithm === "xxhash64") {
if (createXXHash64 === undefined) {
createXXHash64 = require("./hash/xxhash64");
if (BatchedHash === undefined) {
BatchedHash = require("./hash/BatchedHash");
}
}
hash = createXXHash64();
} else if (hashType === "md4") {
hash = new BatchedHash(createXXHash64());
} else if (algorithm === "md4") {
if (createMd4 === undefined) {

@@ -68,15 +74,26 @@ createMd4 = require("./hash/md4");

hash = createMd4();
} else if (hashType === "native-md4") {
hash = new BatchedHash(createMd4());
} else if (algorithm === "native-md4") {
if (typeof crypto === "undefined") {
crypto = require("crypto");
if (BulkUpdateDecorator === undefined) {
BulkUpdateDecorator = require("./hash/BulkUpdateDecorator");
}
}
hash = crypto.createHash("md4");
hash = new BulkUpdateDecorator(() => crypto.createHash("md4"), "md4");
} else {
if (typeof crypto === "undefined") {
crypto = require("crypto");
if (BulkUpdateDecorator === undefined) {
BulkUpdateDecorator = require("./hash/BulkUpdateDecorator");
}
}
hash = crypto.createHash(hashType);
hash = new BulkUpdateDecorator(
() => crypto.createHash(algorithm),
algorithm
);
}

@@ -93,4 +110,3 @@

digestType === "base58" ||
digestType === "base62" ||
digestType === "base64"
digestType === "base62"
) {

@@ -97,0 +113,0 @@ return encodeBufferToBase(hash.digest(), digestType.substr(4)).substr(

{
"name": "loader-utils",
"version": "3.1.0",
"version": "3.1.1",
"author": "Tobias Koppers @sokra",

@@ -10,6 +10,7 @@ "description": "utils for webpack loaders",

"scripts": {
"lint": "prettier --list-different . && eslint lib test",
"lint": "prettier --list-different . && eslint .",
"pretest": "yarn lint",
"test": "jest",
"test:ci": "jest --coverage",
"test:only": "jest --coverage",
"test:ci": "yarn test:only",
"release": "yarn test && standard-version"

@@ -16,0 +17,0 @@ },

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