Added var to properly declare local variables so that they don't pollute the global namespace and risk multi-threading conflicts.
diff --git a/js/securityLib/base64.js b/js/securityLib/base64.js
index b6fd7b7..cc582e2 100644
--- a/js/securityLib/base64.js
+++ b/js/securityLib/base64.js
@@ -29,7 +29,7 @@
var slop;
for(i = 0; i < s.length; ++i) {
if(s.charAt(i) == b64pad) break;
- v = b64map.indexOf(s.charAt(i));
+ var v = b64map.indexOf(s.charAt(i));
if(v < 0) continue;
if(k == 0) {
ret += int2char(v >> 2);
diff --git a/js/securityLib/rsasign-1.2.js b/js/securityLib/rsasign-1.2.js
index 1f02f80..0da2827 100644
--- a/js/securityLib/rsasign-1.2.js
+++ b/js/securityLib/rsasign-1.2.js
@@ -313,9 +313,9 @@
msgHashValue = ff(byteArray);
} else {
// Compute merkle hash
- h = hex_sha256_from_bytes(byteArray);
- index = witness.path.index;
- for (i = witness.path.digestList.length - 1; i >= 0; i--) {
+ var h = hex_sha256_from_bytes(byteArray);
+ var index = witness.path.index;
+ for (var i = witness.path.digestList.length - 1; i >= 0; i--) {
var str = "";
if (index % 2 == 0) {
str = h + witness.path.digestList[i];