Comparing version 1.0.1 to 2.0.0
@@ -9,4 +9,4 @@ const crypto = require('crypto'); | ||
const md5a = crypto.createHmac('md5', '').update('HelloWorld').digest('hex'); | ||
const md5b = crypto.createHmac('md5', '').update('WorldHello').digest('hex'); | ||
const md5a = crypto.createHash('md5').update('HelloWorld').digest('hex'); | ||
const md5b = crypto.createHash('md5').update('WorldHello').digest('hex'); | ||
@@ -21,4 +21,4 @@ expect(ArcHash.md5(exampleArray1)).toEqual(md5a); | ||
const sha256a = crypto.createHmac('sha256', '').update('HelloWorld').digest('hex'); | ||
const sha256b = crypto.createHmac('sha256', '').update('WorldHello').digest('hex'); | ||
const sha256a = crypto.createHash('sha256').update('HelloWorld').digest('hex'); | ||
const sha256b = crypto.createHash('sha256').update('WorldHello').digest('hex'); | ||
@@ -25,0 +25,0 @@ expect(ArcHash.sha256(exampleArray1)).toEqual(sha256a); |
@@ -15,3 +15,3 @@ const crypto = require('crypto'); | ||
const md5 = crypto.createHmac('md5', '').update('AIs a StringB5').digest('hex'); | ||
const md5 = crypto.createHash('md5').update('AIs a StringB5').digest('hex'); | ||
@@ -32,3 +32,3 @@ expect(ArcHash.md5(exampleObject)).toEqual(md5); | ||
const sha256 = crypto.createHmac('sha256', '').update('AIs a StringB5').digest('hex'); | ||
const sha256 = crypto.createHash('sha256').update('AIs a StringB5').digest('hex'); | ||
@@ -71,10 +71,9 @@ expect(ArcHash.sha256(exampleObject)).toEqual(sha256); | ||
expect(ArcHash.sha256(exampleObject)).toEqual('113687bfaf6931fbcb94b78d823f45ed11d16c757c0726d0e844adbd018979da'); | ||
expect(ArcHash.sha256(changedObject)).not.toEqual('113687bfaf6931fbcb94b78d823f45ed11d16c757c0726d0e844adbd018979da'); | ||
expect(ArcHash.sha256(exampleObject)).toEqual('b56306658fa4c164b3b501843fdfe4fb78a9c55336000e94b766c09c4122cecb'); | ||
expect(ArcHash.sha256(changedObject)).not.toEqual('b56306658fa4c164b3b501843fdfe4fb78a9c55336000e94b766c09c4122cecb'); | ||
expect(ArcHash.md5(exampleObject)).toEqual('7d388f6ec86c79805a534c910471c7c7'); | ||
expect(ArcHash.md5(changedObject)).not.toEqual('7d388f6ec86c79805a534c910471c7c7'); | ||
expect(ArcHash.md5(exampleObject)).toEqual('9ef2b1c302591c7429688ceb865ca0b9'); | ||
expect(ArcHash.md5(changedObject)).not.toEqual('9ef2b1c302591c7429688ceb865ca0b9'); | ||
}); | ||
}); |
@@ -8,3 +8,3 @@ const crypto = require('crypto'); | ||
const hmac = crypto.createHmac('md5', ''); | ||
const hmac = crypto.createHash('md5'); | ||
hmac.update(exampleString); | ||
@@ -18,3 +18,3 @@ | ||
const hmac = crypto.createHmac('sha256', ''); | ||
const hmac = crypto.createHash('sha256'); | ||
hmac.update(exampleString); | ||
@@ -21,0 +21,0 @@ |
@@ -10,3 +10,3 @@ const crypto = require('crypto'); | ||
default: | ||
const hmac = crypto.createHmac('md5', ''); | ||
const hmac = crypto.createHash('md5'); | ||
hmac.update(_unknown); | ||
@@ -22,3 +22,3 @@ return hmac.digest('hex'); | ||
default: | ||
const hmac = crypto.createHmac('sha256', ''); | ||
const hmac = crypto.createHash('sha256'); | ||
hmac.update(_unknown); | ||
@@ -25,0 +25,0 @@ return hmac.digest('hex'); |
{ | ||
"name": "arc-hash", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "ES6 convenience library for hashing arrays, objects, strings as md5 or sha256", | ||
@@ -29,7 +29,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"arc-is": "^1.0.5" | ||
"arc-is": "^1.0.6" | ||
}, | ||
"devDependencies": { | ||
"jest": "^21.2.1" | ||
"jest": "^27.4.7" | ||
} | ||
} |
# arc-hash [![Build Status](https://travis-ci.org/anyuzer/arc-hash.svg?branch=master)](https://travis-ci.org/anyuzer/arc-hash) | ||
Convenience ES6 hashing library. Supports object, array and string hashing for md5 and sha256 | ||
**NOTE: 2.0 can be considered a breaking change. The hashes being returned were non standard (ie. did not match externally generated md5s or shas). This is fixed, but the hashes returned will be different that v1, so will be incompatible with stored hashes.** | ||
## Install | ||
@@ -5,0 +7,0 @@ ``` |
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
63
8633
7
Updatedarc-is@^1.0.6