diff --git a/docs/ssvc-calc/findex.html b/docs/ssvc-calc/findex.html index c71740d2..b0b06f8b 100644 --- a/docs/ssvc-calc/findex.html +++ b/docs/ssvc-calc/findex.html @@ -144,7 +144,8 @@

-
+
🔍
- String.fromCharCode('0x' + p))); - var fstr = "d-"+safestr.replace(/[\+\/\=]/gi, - (m,p) => { return m.charCodeAt(0) }); - return fstr.substr(0,14); + const uriEsc = encodeURIComponent(instr); + const base64 = btoa( + uriEsc.replace(/%([0-9A-F]{2})/g, (_, p) => + String.fromCharCode(parseInt(p, 16)) + ) + ) + .replace(/\+/g, "-") + .replace(/\//g, "_") + .replace(/=+$/g, ""); + let h = 0x811c9dc5; + for (let i = 0; i < instr.length; i++) { + h ^= instr.charCodeAt(i); + h = Math.imul(h, 0x01000193); + } + const hash = (h >>> 0).toString(36); + const prefix = base64.slice(0, 24); + return "d-" + prefix + "-" + hash; }