When trying to read an AES encrypted zip file in an environment that does not expose importKey, an exception is encountered when using a password whose length when converted to bits exceeds a block size of 16.
Exception: TypeError: Hash.hash is not a function
Fix:
diff --git a/lib/core/streams/codecs/sjcl.js b/lib/core/streams/codecs/sjcl.js
index 24544dbee63df2f1b0b95740c641af550c9f24c5..abd44b705d7bb61c9e2c090c6057e0a2a7c02e99 100644
--- a/lib/core/streams/codecs/sjcl.js
+++ b/lib/core/streams/codecs/sjcl.js
@@ -774,7 +774,7 @@ misc.hmacSha1 = class {
const bs = hmac._baseHash[0].blockSize / 32;
if (key.length > bs) {
- key = Hash.hash(key);
+ key = new Hash().update(key).finalize();
}
for (let i = 0; i < bs; i++) {
When trying to read an AES encrypted zip file in an environment that does not expose importKey, an exception is encountered when using a password whose length when converted to bits exceeds a block size of 16.
Exception:
TypeError: Hash.hash is not a function
Fix: