summaryrefslogtreecommitdiffstats
path: root/src/sha_dev.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/sha_dev.js')
-rw-r--r--src/sha_dev.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/sha_dev.js b/src/sha_dev.js
index 7cd03cc..f034652 100644
--- a/src/sha_dev.js
+++ b/src/sha_dev.js
@@ -90,6 +90,10 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
for (j = 0; j < binArr.length; j += 1)
{
+ if (((byteCnt >>> 2) + 1) > bin.length)
+ {
+ bin.push(0);
+ }
bin[byteCnt >>> 2] |= binArr[j] << (24 - (8 * (byteCnt % 4)));
byteCnt += 1;
}
@@ -101,6 +105,11 @@ var SUPPORTED_ALGS = 4 | 2 | 1;
{
codePnt = str.charCodeAt(i);
+ if (((byteCnt >>> 2) + 1) > bin.length)
+ {
+ bin.push(0);
+ }
+
bin[byteCnt >>> 2] |= str.charCodeAt(i) << (16 - (8 * (byteCnt % 4)));
byteCnt += 2;
}