mirror of
https://github.com/emn178/js-sha512.git
synced 2026-08-12 20:31:34 +08:00
Fixed incorrect result when file size >= 512M.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
## v0.6.0 / 2017-10-31
|
||||
### Fixed
|
||||
- incorrect result when file size >= 512M.
|
||||
|
||||
## v0.5.0 / 2017-10-07
|
||||
### Added
|
||||
- support for web worker. #5
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "js-sha512",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"main": ["src/sha512.js"],
|
||||
"ignore": [
|
||||
"samples",
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "js-sha512",
|
||||
"version": "0.5.0",
|
||||
"version": "0.6.0",
|
||||
"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": {
|
||||
|
||||
+7
-2
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* [js-sha512]{@link https://github.com/emn178/js-sha512}
|
||||
*
|
||||
* @version 0.5.0
|
||||
* @version 0.6.0
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||
* @license MIT
|
||||
@@ -195,7 +195,7 @@
|
||||
}
|
||||
this.bits = bits;
|
||||
|
||||
this.block = this.start = this.bytes = 0;
|
||||
this.block = this.start = this.bytes = this.hBytes = 0;
|
||||
this.finalized = this.hashed = false;
|
||||
}
|
||||
|
||||
@@ -274,6 +274,10 @@
|
||||
this.start = i;
|
||||
}
|
||||
}
|
||||
if (this.bytes > 4294967295) {
|
||||
this.hBytes += this.bytes / 4294967296 << 0;
|
||||
this.bytes = this.bytes % 4294967296;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -300,6 +304,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[31] = this.bytes << 3;
|
||||
this.hash();
|
||||
};
|
||||
|
||||
@@ -316,6 +316,13 @@
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
context('when large size', function () {
|
||||
var hash = algorithm.create();
|
||||
hash.bytes = 4294967295;
|
||||
hash.update('any');
|
||||
expect(hash.hBytes).to.be(1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user