From 0a054b8d9427f42ae051d7a2a2193ac8dbec0cea Mon Sep 17 00:00:00 2001 From: hppeng Date: Mon, 2 Jan 2023 17:31:55 -0800 Subject: [PATCH] Fix bug with encoding fixed ID values that are exactly a powe of 64 --- js/custom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/custom.js b/js/custom.js index 42ec3f7..20ed6c8 100644 --- a/js/custom.js +++ b/js/custom.js @@ -76,7 +76,7 @@ function encodeCustom(custom, verbose) { hash += Base64.fromIntN(i, 2) + Base64.fromIntN(val.replaceAll(" ", "%20").length, 2) + val.replaceAll(" ", "%20"); //values cannot go above 4096 chars!!!! Is this ok? } } else if (typeof (val) === "number" && val != 0) { - let len = Math.max(1, Math.ceil(log(64, Math.abs(val)))); + let len = Math.max(1, Math.ceil(log(64, Math.abs(val) + 1))); let sign = Boolean(val / Math.abs(val) < 0) | 0; //console.log(sign); //hash += Base64.fromIntN(i,2) + Base64.fromIntN(val,Math.max(1,Math.ceil(log(64,Math.abs(val))))) + "_";