Comparing version 5.2.2 to 5.2.3
@@ -5,2 +5,13 @@ # Change Log | ||
<a name="5.2.3"></a> | ||
## [5.2.3](https://github.com/zkat/ssri/compare/v5.2.2...v5.2.3) (2018-02-16) | ||
### Bug Fixes | ||
* **hashes:** filter hash priority list by available hashes ([2fa30b8](https://github.com/zkat/ssri/commit/2fa30b8)) | ||
* **integrityStream:** dedupe algorithms to generate ([d56c654](https://github.com/zkat/ssri/commit/d56c654)) | ||
<a name="5.2.2"></a> | ||
@@ -7,0 +18,0 @@ ## [5.2.2](https://github.com/zkat/ssri/compare/v5.2.1...v5.2.2) (2018-02-14) |
13
index.js
@@ -252,4 +252,8 @@ 'use strict' | ||
// Calculating stream | ||
const algorithms = (opts.algorithms || ['sha512']) | ||
.concat(algorithm ? [algorithm] : []) | ||
const algorithms = Array.from( | ||
new Set( | ||
(opts.algorithms || ['sha512']) | ||
.concat(algorithm ? [algorithm] : []) | ||
) | ||
) | ||
const hashes = algorithms.map(crypto.createHash) | ||
@@ -331,2 +335,4 @@ let streamSize = 0 | ||
const NODE_HASHES = new Set(crypto.getHashes()) | ||
// This is a Best Effort™ at a reasonable priority for hash algos | ||
@@ -340,3 +346,4 @@ const DEFAULT_PRIORITY = [ | ||
'sha3_256', 'sha3_384', 'sha3_512' | ||
] | ||
].filter(algo => NODE_HASHES.has(algo)) | ||
function getPrioritizedHash (algo1, algo2) { | ||
@@ -343,0 +350,0 @@ return DEFAULT_PRIORITY.indexOf(algo1.toLowerCase()) >= DEFAULT_PRIORITY.indexOf(algo2.toLowerCase()) |
{ | ||
"name": "ssri", | ||
"version": "5.2.2", | ||
"version": "5.2.3", | ||
"description": "Standard Subresource Integrity library -- parses, serializes, generates, and verifies integrity metadata according to the SRI spec.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
39070
327