diff --git a/lib/crypto/sha256.js b/lib/crypto/sha256.js index 91e85c3d..f931e661 100644 --- a/lib/crypto/sha256.js +++ b/lib/crypto/sha256.js @@ -251,23 +251,22 @@ SHA256Hmac.prototype.init = function init(data) { this.inner.init(); this.inner.update(data); this.inner._finish(key); - key.fill(0, 32); + key.fill(0, 32, 64); } else { data.copy(key, 0); key.fill(0, data.length, 64); } - this.inner.init(); - this.outer.init(); - for (i = 0; i < key.length; i++) key[i] ^= 0x36; + this.inner.init(); this.inner.update(key); for (i = 0; i < key.length; i++) key[i] ^= 0x6a; + this.outer.init(); this.outer.update(key); };