Comparing version 1.2.0 to 1.2.1
32
hash.js
@@ -11,2 +11,3 @@ var u = require('./util') | ||
this._finalSize = finalSize | ||
this._blockSize = blockSize | ||
this._len = 0 | ||
@@ -27,3 +28,3 @@ this._l = 0 | ||
//https://github.com/chrisdickinson/to-utf8 | ||
var bl = this._block.byteLength | ||
var bl = this._blockSize | ||
//for now, assume ascii. | ||
@@ -33,12 +34,16 @@ | ||
//http://nodejs.org/api/string_decoder.html | ||
if('string' === typeof data && !enc) | ||
enc = 'utf8' | ||
var length | ||
if(!enc && 'string' === typeof data) | ||
enc = 'utf8' | ||
if(enc === 'utf-8') | ||
enc = 'utf8' | ||
if(enc) { | ||
if(enc === 'utf-8') | ||
enc = 'utf8' | ||
if(enc === 'base64' || enc === 'utf8') | ||
data = toBuffer(data, enc), enc = null | ||
if(enc === 'base64' || enc === 'utf8') | ||
data = toBuffer(data, enc), enc = null | ||
length = lengthOf(data, enc) | ||
} else | ||
length = data.byteLength || data.length | ||
var length = lengthOf(data, enc) | ||
var l = this._len += length | ||
@@ -50,9 +55,7 @@ var s = this._s = (this._s || 0) | ||
u.write(this._block.buffer, data, enc, s%bl, f, t) | ||
var ch = (t - f); s += ch; f += ch | ||
var ch = (t - f); | ||
s += ch; f += ch | ||
if(!(s%bl)) { | ||
if(!(s%bl)) | ||
this._update(this._block.buffer) | ||
u.zeroFill(this._block.buffer, 0) | ||
} | ||
} | ||
@@ -67,3 +70,3 @@ this._s = s | ||
//how much message is leftover | ||
var bl = this._block.byteLength | ||
var bl = this._blockSize | ||
var fl = this._finalSize | ||
@@ -81,2 +84,3 @@ var len = this._len*8 | ||
x[this._len % bl] = 0x80 | ||
u.zeroFill(this._block.buffer, this._len % bl + 1) | ||
@@ -83,0 +87,0 @@ if(bits >= fl*8) { |
{ | ||
"name": "sha.js", | ||
"description": "streaming sha1 hash in pure javascript", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"homepage": "https://github.com/dominictarr/sha.js", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -52,3 +52,2 @@ /* | ||
var H = this._dvH | ||
var h32 = this._h32 | ||
@@ -55,0 +54,0 @@ var h = this._h |
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
796581
3477