Fixed incorrect result when first bit is 1 of bytes.

pull/22/head v0.7.1
Yi-Cyuan Chen 8 years ago
parent 6aed3e39c4
commit 241405d4fd

@ -1,2 +0,0 @@
/node_modules/
/tests/

3
.gitignore vendored

@ -1,2 +1,3 @@
/node_modules/
/covreporter/
/coverage/
/.nyc_output/

@ -1,7 +1,7 @@
/node_modules/
/covreporter/
/coverage/
/.nyc_output/
/tests/
.covignore
.travis.yml
.npmignore
bower.json

@ -4,8 +4,7 @@ node_js:
- "8.6.0"
before_install:
- npm install coveralls
- npm install mocha-lcov-reporter
script: npm run-script coveralls
after_success: npm run coveralls
branches:
only:
- master

@ -1,5 +1,9 @@
# Change Log
## v0.7.1 / 2017-12-21
### Fixed
- incorrect result when first bit is 1 of bytes.
## v0.7.0 / 2017-11-19
### Added
- support HMAC. #8

@ -1,6 +1,6 @@
{
"name": "js-sha512",
"version": "0.7.0",
"version": "0.7.1",
"main": ["src/sha512.js"],
"ignore": [
"samples",

File diff suppressed because one or more lines are too long

1817
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,21 +1,21 @@
{
"name": "js-sha512",
"version": "0.7.0",
"version": "0.7.1",
"description": "This is a simple SHA-512, SHA-384, SHA-512/224, SHA-512/256 hash functions for JavaScript supports UTF-8 encoding.",
"main": "src/sha512.js",
"devDependencies": {
"expect.js": "~0.3.1",
"jscoverage": "^0.6.0",
"mocha": "~2.3.4",
"nyc": "^11.3.0",
"requirejs": "^2.1.22",
"uglifyjs": "^2.4.11",
"uglify-js": "^3.1.9",
"webworker-threads": "^0.7.11"
},
"scripts": {
"test": "mocha tests/node-test.js -r jscoverage",
"report": "mocha tests/node-test.js -r jscoverage --covout=html",
"coveralls": "mocha tests/node-test.js -R mocha-lcov-reporter -r jscoverage | coveralls",
"build": "uglifyjs src/sha512.js --compress --mangle --comments --output build/sha512.min.js"
"test": "nyc mocha tests/node-test.js",
"report": "nyc --reporter=html --reporter=text mocha tests/node-test.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"build": "uglifyjs src/sha512.js -c -m eval --comments -o build/sha512.min.js"
},
"repository": {
"type": "git",
@ -39,5 +39,9 @@
"bugs": {
"url": "https://github.com/emn178/js-sha512/issues"
},
"dependencies": {}
"nyc": {
"exclude": [
"tests"
]
}
}

@ -1,7 +1,7 @@
/*
* [js-sha512]{@link https://github.com/emn178/js-sha512}
*
* @version 0.7.0
* @version 0.7.1
* @author Chen, Yi-Cyuan [emn178@gmail.com]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
@ -324,7 +324,7 @@
blocks[25] = blocks[26] = blocks[27] = blocks[28] =
blocks[29] = blocks[30] = blocks[31] = blocks[32] = 0;
}
blocks[30] = this.hBytes << 3 | this.bytes >> 29;
blocks[30] = this.hBytes << 3 | this.bytes >>> 29;
blocks[31] = this.bytes << 3;
this.hash();
};

@ -109,12 +109,24 @@
'Hi There'
]
};
testCases.sha512_hmac['Uint8Array'] = {
'f7688a104326d36c1940f6d28d746c0661d383e0d14fe8a04649444777610f5dd9565a36846ab9e9e734cf380d3a070d8ef021b5f3a50c481710a464968e3419': [
new Uint8Array(0),
'Hi There'
]
};
testCases.sha384_hmac['ArrayBuffer'] = {
'da5393cef424a670d6db42c6ed6e7920779dfa4cbb98bf1c2e9c12ae10d10905d0c9e9d576c2a613be54b8daea246d4b': [
new ArrayBuffer(0),
'Hi There'
]
};
testCases.sha384_hmac['Uint8Array'] = {
'da5393cef424a670d6db42c6ed6e7920779dfa4cbb98bf1c2e9c12ae10d10905d0c9e9d576c2a613be54b8daea246d4b': [
new Uint8Array(0),
'Hi There'
]
};
}
var errorTestCases = [null, undefined, { length: 0 }, 0, 1, false, true, NaN, Infinity, function () {}];

Loading…
Cancel
Save