fix sha256 hex conversion
This commit is contained in:
parent
e94636ef25
commit
44c8683924
1 changed files with 3 additions and 1 deletions
|
@ -5,6 +5,8 @@
|
||||||
* http://code.google.com/p/crypto-js/wiki/License
|
* http://code.google.com/p/crypto-js/wiki/License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
var conv = require('../convert');
|
||||||
|
|
||||||
// Convert a byte array to big-endian 32-bit words
|
// Convert a byte array to big-endian 32-bit words
|
||||||
var bytesToWords = function (bytes) {
|
var bytesToWords = function (bytes) {
|
||||||
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
|
for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
|
||||||
|
@ -51,7 +53,7 @@ var SHA256 = C.SHA256 = function (message, options) {
|
||||||
var digestbytes = wordsToBytes(SHA256._sha256(message));
|
var digestbytes = wordsToBytes(SHA256._sha256(message));
|
||||||
return options && options.asBytes ? digestbytes :
|
return options && options.asBytes ? digestbytes :
|
||||||
options && options.asString ? Binary.bytesToString(digestbytes) :
|
options && options.asString ? Binary.bytesToString(digestbytes) :
|
||||||
util.bytesToHex(digestbytes);
|
conv.bytesToHex(digestbytes);
|
||||||
};
|
};
|
||||||
|
|
||||||
// The core
|
// The core
|
||||||
|
|
Loading…
Add table
Reference in a new issue