diff --git a/auth/index.html b/auth/index.html
index 2e7167e..24a4cd4 100644
--- a/auth/index.html
+++ b/auth/index.html
@@ -213,7 +213,8 @@
Message log
* @returns {Uint8Array}
*/
var uint8arrayFromHexString = function(hexString) {
- if (!hexString || hexString.length % 2 != 0 || !/^[0-9A-Fa-f]+$/.test(hexString)) {
+ var hexRegex = /^[0-9A-Fa-f]+$/;
+ if (!hexString || hexString.length % 2 != 0 || !hexRegex.test(hexString)) {
throw new Error('cannot create uint8array from invalid hex string: "' + hexString + '"');
}
return new Uint8Array(hexString.match(/../g).map(h=>parseInt(h,16)));
diff --git a/export/index.html b/export/index.html
index a55f9ca..f02e314 100644
--- a/export/index.html
+++ b/export/index.html
@@ -202,7 +202,8 @@ Message log
* @returns {Uint8Array}
*/
const uint8arrayFromHexString = function(hexString) {
- if (!hexString || hexString.length % 2 != 0 || !/^[0-9A-Fa-f]+$/.test(hexString)) {
+ var hexRegex = /^[0-9A-Fa-f]+$/;
+ if (!hexString || hexString.length % 2 != 0 || !hexRegex.test(hexString)) {
throw new Error('cannot create uint8array from invalid hex string: "' + hexString + '"');
}
return new Uint8Array(hexString.match(/../g).map(h=>parseInt(h,16)));