mirror of
https://github.com/planetrenox/inzerosight.git
synced 2026-09-18 10:05:44 +00:00
5 lines
12 KiB
JavaScript
5 lines
12 KiB
JavaScript
(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))p(d);new MutationObserver(d=>{for(const b of d)if(b.type==="childList")for(const s of b.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&p(s)}).observe(document,{childList:!0,subtree:!0});function f(d){const b={};return d.integrity&&(b.integrity=d.integrity),d.referrerPolicy&&(b.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?b.credentials="include":d.crossOrigin==="anonymous"?b.credentials="omit":b.credentials="same-origin",b}function p(d){if(d.ep)return;d.ep=!0;const b=f(d);fetch(d.href,b)}})();const w={3:{unifier:"",0:"",1:"",2:""},6:{unifier:"",0:"",1:"",2:"",3:"",4:"",5:""},8:{unifier:"",0:"",1:"",2:"",3:"",4:"",5:"",6:"",7:"\uFEFF"},encodeString:(c,r=3)=>Array.from(c,f=>f.codePointAt(0).toString(r).split("").map(p=>w[r][p]).join("")).join(w[r].unifier),encodeNumberArray:(c,r=3)=>c.map(f=>f.toString(r).split("").map(p=>w[r][p]).join("")).join(w[r].unifier),decodeToString:(c,r=3)=>c.split(w[r].unifier).map(f=>String.fromCodePoint(parseInt(Array.from(f).map(p=>Object.keys(w[r]).find(d=>w[r][d]===p)).join(""),r))).join(""),decodeToNumberArray:(c,r=3)=>c.split(w[r].unifier).map(f=>parseInt(Array.from(f).map(p=>Object.keys(w[r]).find(d=>w[r][d]===p)).join(""),r))};function ee(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var T,_;function te(){if(_)return T;_=1;function c(r={}){const f=r.bits||16,p=r.rounds||22,d=r.rightRotations||7,b=r.leftRotations||2,s=2**f,o=s-1,l=(i,t)=>i>>t|i<<f-t&o,m=(i,t)=>i<<t&o|i>>f-t,k=(i,t,e)=>(i=l(i,d),i=i+t&o,i^=e,t=m(t,b),t^=i,[i,t]),A=(i,t,e)=>(t^=i,t=l(t,b),i^=e,i=i-t&o,i=m(i,d),[i,t]);function I(i,t){let e=i[0],u=i[1],n=t[0],g=t.slice(1);[u,e]=k(u,e,n);for(let h=0;h<p-1;h++){const y=h%g.length;[g[y],n]=k(g[y],n,h),[u,e]=k(u,e,n)}return[e,u]}function E(i,t){let e=i[0],u=i[1],n=t[0],g=t.slice(1);for(let h=0;h<p-1;h++){const y=h%g.length;[g[y],n]=k(g[y],n,h)}for(let h=0;h<p;h++){const y=(p-2-h)%g.length;[u,e]=A(u,e,n),[g[y],n]=A(g[y],n,p-2-h)}return[e,u]}function a(i){return(t,e)=>{const u=i([t/s|0,t&o],e);return u[0]*s+u[1]}}return{encrypt:a(I),decrypt:a(E),encryptRaw:I,decryptRaw:E}}return T=c,T}var ne=te();const G=ee(ne);var C,N;function K(){if(N)return C;N=1;const c="Input must be an string, Buffer or Uint8Array";function r(s){let o;if(s instanceof Uint8Array)o=s;else if(typeof s=="string")o=new TextEncoder().encode(s);else throw new Error(c);return o}function f(s){return Array.prototype.map.call(s,function(o){return(o<16?"0":"")+o.toString(16)}).join("")}function p(s){return(4294967296+s).toString(16).substring(1)}function d(s,o,l){let m=`
|
||
`+s+" = ";for(let k=0;k<o.length;k+=2){if(l===32)m+=p(o[k]).toUpperCase(),m+=" ",m+=p(o[k+1]).toUpperCase();else if(l===64)m+=p(o[k+1]).toUpperCase(),m+=p(o[k]).toUpperCase();else throw new Error("Invalid size "+l);k%6===4?m+=`
|
||
`+new Array(s.length+4).join(" "):k<o.length-2&&(m+=" ")}console.log(m)}function b(s,o,l){let m=new Date().getTime();const k=new Uint8Array(o);for(let I=0;I<o;I++)k[I]=I%256;const A=new Date().getTime();console.log("Generated random input in "+(A-m)+"ms"),m=A;for(let I=0;I<l;I++){const E=s(k),a=new Date().getTime(),i=a-m;m=a,console.log("Hashed in "+i+"ms: "+E.substring(0,20)+"..."),console.log(Math.round(o/(1<<20)/(i/1e3)*100)/100+" MB PER SECOND")}}return C={normalizeInput:r,toHex:f,debugPrint:d,testSpeed:b},C}var D,P;function re(){if(P)return D;P=1;const c=K();function r(e,u,n){const g=e[u]+e[n];let h=e[u+1]+e[n+1];g>=4294967296&&h++,e[u]=g,e[u+1]=h}function f(e,u,n,g){let h=e[u]+n;n<0&&(h+=4294967296);let y=e[u+1]+g;h>=4294967296&&y++,e[u]=h,e[u+1]=y}function p(e,u){return e[u]^e[u+1]<<8^e[u+2]<<16^e[u+3]<<24}function d(e,u,n,g,h,y){const Z=m[h],X=m[h+1],J=m[y],Q=m[y+1];r(l,e,u),f(l,e,Z,X);let B=l[g]^l[e],S=l[g+1]^l[e+1];l[g]=S,l[g+1]=B,r(l,n,g),B=l[u]^l[n],S=l[u+1]^l[n+1],l[u]=B>>>24^S<<8,l[u+1]=S>>>24^B<<8,r(l,e,u),f(l,e,J,Q),B=l[g]^l[e],S=l[g+1]^l[e+1],l[g]=B>>>16^S<<16,l[g+1]=S>>>16^B<<16,r(l,n,g),B=l[u]^l[n],S=l[u+1]^l[n+1],l[u]=S>>>31^B<<1,l[u+1]=B>>>31^S<<1}const b=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),s=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],o=new Uint8Array(s.map(function(e){return e*2})),l=new Uint32Array(32),m=new Uint32Array(32);function k(e,u){let n=0;for(n=0;n<16;n++)l[n]=e.h[n],l[n+16]=b[n];for(l[24]=l[24]^e.t,l[25]=l[25]^e.t/4294967296,u&&(l[28]=~l[28],l[29]=~l[29]),n=0;n<32;n++)m[n]=p(e.b,4*n);for(n=0;n<12;n++)d(0,8,16,24,o[n*16+0],o[n*16+1]),d(2,10,18,26,o[n*16+2],o[n*16+3]),d(4,12,20,28,o[n*16+4],o[n*16+5]),d(6,14,22,30,o[n*16+6],o[n*16+7]),d(0,10,20,30,o[n*16+8],o[n*16+9]),d(2,12,22,24,o[n*16+10],o[n*16+11]),d(4,14,16,26,o[n*16+12],o[n*16+13]),d(6,8,18,28,o[n*16+14],o[n*16+15]);for(n=0;n<16;n++)e.h[n]=e.h[n]^l[n]^l[n+16]}const A=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function I(e,u,n,g){if(e===0||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(u&&u.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(n&&n.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(g&&g.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const h={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};A.fill(0),A[0]=e,u&&(A[1]=u.length),A[2]=1,A[3]=1,n&&A.set(n,32),g&&A.set(g,48);for(let y=0;y<16;y++)h.h[y]=b[y]^p(A,y*4);return u&&(E(h,u),h.c=128),h}function E(e,u){for(let n=0;n<u.length;n++)e.c===128&&(e.t+=e.c,k(e,!1),e.c=0),e.b[e.c++]=u[n]}function a(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;k(e,!0);const u=new Uint8Array(e.outlen);for(let n=0;n<e.outlen;n++)u[n]=e.h[n>>2]>>8*(n&3);return u}function i(e,u,n,g,h){n=n||64,e=c.normalizeInput(e),g&&(g=c.normalizeInput(g)),h&&(h=c.normalizeInput(h));const y=I(n,u,g,h);return E(y,e),a(y)}function t(e,u,n,g,h){const y=i(e,u,n,g,h);return c.toHex(y)}return D={blake2b:i,blake2bHex:t,blake2bInit:I,blake2bUpdate:E,blake2bFinal:a},D}var O,v;function oe(){if(v)return O;v=1;const c=K();function r(a,i){return a[i]^a[i+1]<<8^a[i+2]<<16^a[i+3]<<24}function f(a,i,t,e,u,n){s[a]=s[a]+s[i]+u,s[e]=p(s[e]^s[a],16),s[t]=s[t]+s[e],s[i]=p(s[i]^s[t],12),s[a]=s[a]+s[i]+n,s[e]=p(s[e]^s[a],8),s[t]=s[t]+s[e],s[i]=p(s[i]^s[t],7)}function p(a,i){return a>>>i^a<<32-i}const d=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),b=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),s=new Uint32Array(16),o=new Uint32Array(16);function l(a,i){let t=0;for(t=0;t<8;t++)s[t]=a.h[t],s[t+8]=d[t];for(s[12]^=a.t,s[13]^=a.t/4294967296,i&&(s[14]=~s[14]),t=0;t<16;t++)o[t]=r(a.b,4*t);for(t=0;t<10;t++)f(0,4,8,12,o[b[t*16+0]],o[b[t*16+1]]),f(1,5,9,13,o[b[t*16+2]],o[b[t*16+3]]),f(2,6,10,14,o[b[t*16+4]],o[b[t*16+5]]),f(3,7,11,15,o[b[t*16+6]],o[b[t*16+7]]),f(0,5,10,15,o[b[t*16+8]],o[b[t*16+9]]),f(1,6,11,12,o[b[t*16+10]],o[b[t*16+11]]),f(2,7,8,13,o[b[t*16+12]],o[b[t*16+13]]),f(3,4,9,14,o[b[t*16+14]],o[b[t*16+15]]);for(t=0;t<8;t++)a.h[t]^=s[t]^s[t+8]}function m(a,i){if(!(a>0&&a<=32))throw new Error("Incorrect output length, should be in [1, 32]");const t=i?i.length:0;if(i&&!(t>0&&t<=32))throw new Error("Incorrect key length, should be in [1, 32]");const e={h:new Uint32Array(d),b:new Uint8Array(64),c:0,t:0,outlen:a};return e.h[0]^=16842752^t<<8^a,t>0&&(k(e,i),e.c=64),e}function k(a,i){for(let t=0;t<i.length;t++)a.c===64&&(a.t+=a.c,l(a,!1),a.c=0),a.b[a.c++]=i[t]}function A(a){for(a.t+=a.c;a.c<64;)a.b[a.c++]=0;l(a,!0);const i=new Uint8Array(a.outlen);for(let t=0;t<a.outlen;t++)i[t]=a.h[t>>2]>>8*(t&3)&255;return i}function I(a,i,t){t=t||32,a=c.normalizeInput(a);const e=m(t,i);return k(e,a),A(e)}function E(a,i,t){const e=I(a,i,t);return c.toHex(e)}return O={blake2s:I,blake2sHex:E,blake2sInit:m,blake2sUpdate:k,blake2sFinal:A},O}var j,x;function ie(){if(x)return j;x=1;const c=re(),r=oe();return j={blake2b:c.blake2b,blake2bHex:c.blake2bHex,blake2bInit:c.blake2bInit,blake2bUpdate:c.blake2bUpdate,blake2bFinal:c.blake2bFinal,blake2s:r.blake2s,blake2sHex:r.blake2sHex,blake2sInit:r.blake2sInit,blake2sUpdate:r.blake2sUpdate,blake2sFinal:r.blake2sFinal},j}var z=ie();const Y=G({bits:24,rounds:23,rightRotations:8,leftRotations:3});function H(c){const r=z.blake2bHex(c,null,12);return[parseInt(r.slice(0,6),16),parseInt(r.slice(6,12),16),parseInt(r.slice(12,18),16),parseInt(r.slice(18,24),16)]}function ce(c,r){const f=globalThis.crypto.getRandomValues(new Uint32Array(1))[0]&16777215,p=Array.from(c,(d,b)=>{const s=f*16777216+(b&16777215),o=Y.encrypt(s,r);return(d.codePointAt(0)^o)>>>0});return[f,...p]}function se(c,r){if(!c||c.length===0)return"";const f=c[0];return c.slice(1).map((d,b)=>{const s=f*16777216+(b&16777215),o=Y.encrypt(s,r),l=(d^o)>>>0;try{return String.fromCodePoint(l)}catch{return""}}).join("")}const $=G();function L(c){const r=z.blake2bHex(c,null,8);return[parseInt(r.slice(0,4),16),parseInt(r.slice(4,8),16),parseInt(r.slice(8,12),16),parseInt(r.slice(12,16),16)]}function le(c,r){return Array.from(c,f=>$.encrypt(f.codePointAt(0),r))}function ue(c,r){return c.map(f=>{try{return String.fromCodePoint($.decrypt(f,r))}catch{return""}}).join("")}const U=document.getElementById("textarea"),M=document.getElementById("encoder"),ae=document.getElementById("cipher"),V=document.getElementById("sign"),F=document.getElementById("sigDetect"),R={3:"",6:"",8:"\uFEFF"};document.getElementById("encodeButton").addEventListener("click",W);document.getElementById("decodeButton").addEventListener("click",W);V.addEventListener("click",c=>c.target.classList.toggle("on"));let q;function W(c){if(clearTimeout(q),F.className="",U.value===""){U.value="The text box is empty.";return}const r=c.target.id==="encodeButton"?"NO":"YES",f=fe();let p=M.value.split("-")[1],d=U.value;if(r==="YES"){const o=Object.keys(R).find(l=>d.includes(R[l]));o&&(o!==p&&(F.textContent=`ZWUS-${o} signature detected`,F.className="show",q=setTimeout(()=>F.className="",2e3)),p=o,M.value="ZWUS-"+p,d=d.replace(R[p],""))}const b=f!=="PLAIN",s=b&&prompt("enter password.");if(!(b&&!s)){try{let o=de[r][f](d,p,s);r==="NO"&&V.classList.contains("on")&&(o=R[p]+o),U.value=o}catch(o){console.log(o)}r==="NO"&&(U.select(),document.execCommand("copy"),U.value=`Copied to your clipboard.
|
||
A copy has been placed between these brackets [`+U.value+"]")}}function fe(){return ae.value}const de={NO:{PLAIN:(c,r)=>w.encodeString(c,r),SPECK48_96CTR:(c,r,f)=>w.encodeNumberArray(ce(c,H(f)),r),"SPECK32_64ECB (insecure)":(c,r,f)=>w.encodeNumberArray(le(c,L(f)),r)},YES:{PLAIN:(c,r)=>w.decodeToString(c,r),SPECK48_96CTR:(c,r,f)=>se(w.decodeToNumberArray(c,r),H(f)),"SPECK32_64ECB (insecure)":(c,r,f)=>ue(w.decodeToNumberArray(c,r),L(f))}};
|