Sandstorm v1.3 — layer dial 4 to 1000 AES-256 layers, each its own key; SHA-512 chain; 4 glass packets
90b7c2f verified Download storm/index.html from SANDDIDIT/ghost: direct link, hf CLI and curl.
- Browser
- Download file 7.11 kB
-
https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/storm/index.html
- Command line
-
hf download hf://spaces/SANDDIDIT/ghost/storm/index.html
-
curl -L -o index.html https://huggingface.co/spaces/SANDDIDIT/ghost/resolve/main/storm/index.html
7.11 kB
| <html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"> | |
| <title>SANDSTORM</title> | |
| <style> | |
| body{margin:0;background:#04060c;color:#f3e2b3;font:14px system-ui;padding:14px;max-width:900px;margin:auto} | |
| h1{letter-spacing:4px;font-size:20px;margin:8px 0} | |
| textarea{width:100%;height:90px;box-sizing:border-box;background:#0b1222;color:#fff;border:1px solid #2b3d63;border-radius:10px;padding:10px;font-size:15px} | |
| .row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0} | |
| select,button{background:#0b1222;color:#f3e2b3;border:1px solid #c9a75d;border-radius:8px;padding:8px 12px;font:inherit} | |
| input[type=range]{flex:1;accent-color:#c9a75d} | |
| button.go{background:#c9a75d;color:#04060c;font-weight:700} | |
| #snake{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px} | |
| .seg{flex:1 1 200px;background:linear-gradient(135deg,#ffffff14,#7fc4ff10);border:1px solid #9fd3ff55;border-radius:14px;padding:9px;word-break:break-all;animation:in .4s ease both} | |
| .seg b{color:#fff}.seg small{opacity:.6;display:block}.seg a{color:#7fc4ff}.seg code{font-size:11px;color:#9fe39f} | |
| .shard{border-color:#d4af3788;cursor:pointer}.shard.picked{outline:2px solid #d4af37}.pkt{border-color:#ff5a5a66} | |
| @keyframes in{from{opacity:0;transform:translateY(8px)}to{opacity:1}} | |
| #out{margin-top:10px;padding:10px;border-radius:10px;background:#0b1222;display:none} | |
| </style></head><body> | |
| <h1>🌪️ SANDSTORM</h1> | |
| <textarea id="msg" placeholder="anything you want wrapped in the storm"></textarea> | |
| <div class="row">Glass layers <input id="ly" type="range" min="4" max="1000" value="4"><b id="lyv">4</b></div> | |
| <div class="row">Shards <select id="n"><option>3</option><option selected>5</option><option>7</option><option>9</option></select> | |
| need <select id="k"><option>2</option><option selected>3</option><option>4</option><option>5</option></select> to rebuild | |
| <button class="go" id="go">🌪️ Storm it</button></div> | |
| <div id="snake"></div> | |
| <div class="row" id="rb" style="display:none"><span>Tap shards to pick them, then</span><button id="re">🧩 Rebuild</button></div> | |
| <div id="out"></div> | |
| <script> | |
| const ALGS=['AES-CTR','AES-GCM','AES-CBC','AES-GCM']; | |
| const TL={aes:'https://github.com/openssl/openssl',sha:'https://github.com/B-Con/crypto-algorithms',shamir:'https://github.com/libtom/libtomcrypt',b64:'https://github.com/libtom/libtomcrypt',chain:'https://monocypher.org'}; | |
| const enc=new TextEncoder(),dec=new TextDecoder(); | |
| const hex=b=>[...new Uint8Array(b)].map(x=>x.toString(16).padStart(2,'0')).join(''); | |
| const sha=async b=>hex(await crypto.subtle.digest('SHA-512',b)); | |
| const ly=document.getElementById('ly'),lyv=document.getElementById('lyv');ly.oninput=()=>lyv.textContent=`${ly.value} · 2^${256*ly.value} key space`;ly.oninput(); | |
| const EXP=new Uint8Array(512),LOG=new Uint8Array(256);{let x=1;for(let i=0;i<255;i++){EXP[i]=x;LOG[x]=i;const xt=((x<<1)^(x&0x80?0x1b:0))&0xff;x^=xt}for(let i=255;i<512;i++)EXP[i]=EXP[i-255]} | |
| const mul=(a,b)=>a&&b?EXP[LOG[a]+LOG[b]]:0,dv=(a,b)=>a?EXP[(LOG[a]+255-LOG[b])%255]:0; | |
| function split(sec,n,k){const sh=[...Array(n)].map((_,i)=>({x:i+1,y:new Uint8Array(sec.length)})); | |
| sec.forEach((s,bi)=>{const c=[s,...crypto.getRandomValues(new Uint8Array(k-1))];sh.forEach(S=>{let y=0;for(let j=c.length-1;j>=0;j--)y=mul(y,S.x)^c[j];S.y[bi]=y})});return sh} | |
| function combine(sh){const L=sh[0].y.length,out=new Uint8Array(L); | |
| for(let b=0;b<L;b++){let s=0;sh.forEach((Si,i)=>{let num=1,den=1;sh.forEach((Sj,j)=>{if(i!==j){num=mul(num,Sj.x);den=mul(den,Sj.x^Si.x)}});s^=mul(Si.y[b],dv(num,den))});out[b]=s}return out} | |
| const params=(a,v)=>a==='AES-CTR'?{name:a,counter:v,length:64}:a==='AES-CBC'?{name:a,iv:v}:{name:a,iv:v.slice(0,12)}; | |
| const ik=(a,raw)=>crypto.subtle.importKey('raw',raw,a,false,['encrypt','decrypt']); | |
| let state=null;const snake=document.getElementById('snake'); | |
| function seg(cls,title,url,lab,body,t){const d=document.createElement('div');d.className='seg '+cls; | |
| d.innerHTML=`<b>${title}</b><small>${t?new Date(t).toISOString()+' · ':''}<a href="${url}" target=_blank>${lab}</a></small><code>${body}</code>`;snake.appendChild(d);return d} | |
| document.getElementById('go').onclick=async()=>{ | |
| const m=document.getElementById('msg').value;if(!m)return;const N=+ly.value,n=+document.getElementById('n').value,k=Math.min(+document.getElementById('k').value,n); | |
| snake.innerHTML='';document.getElementById('out').style.display='none'; | |
| let prev='0'.repeat(128);const link=async(cls,title,url,lab,bytes,show)=>{const t=Date.now();const h=await sha(enc.encode(prev+hex(bytes)+t));prev=h; | |
| return seg(cls,title,url,lab,(show||'')+`<br>🔗 ${h.slice(0,32)}…`,t)}; | |
| let data=enc.encode(btoa(unescape(encodeURIComponent(m)))); | |
| await link('','1 · Twist + braid',TL.b64,'Base64 braid',data,dec.decode(data).slice(0,60)); | |
| const key=new Uint8Array(32*N);for(let o=0;o<key.length;o+=65536)crypto.getRandomValues(key.subarray(o,Math.min(o+65536,key.length))); | |
| const ivs=[...Array(N)].map(()=>crypto.getRandomValues(new Uint8Array(16))); | |
| const t0=performance.now(); | |
| for(let i=0;i<N;i++){const a=ALGS[i%4];data=new Uint8Array(await crypto.subtle.encrypt(params(a,ivs[i]),await ik(a,key.slice(i*32,i*32+32)),data)); | |
| if(i<3||i===N-1)await link('',`2 · Glass ${i+1} of ${N} · ${a}-256`,TL.aes,'own 256-bit key',data,hex(data).slice(0,48)+'…'); | |
| else if(i===3)seg('',`… glass 4 to ${N-1}`,TL.aes,`${N-4} more layers`,'each its own key, each chained',0);} | |
| const ms=Math.round(performance.now()-t0); | |
| const P=4,size=Math.ceil(data.length/P),pk=[]; | |
| for(let p=0;p<P;p++){const part=data.slice(p*size,(p+1)*size);pk.push(part);await link('pkt',`3 · Glass packet ${p+1} of ${P}`,TL.sha,'SHA-512 encased',part,hex(part).slice(0,40)+'…')} | |
| const sh=split(key,n,k); | |
| for(const S of sh){const d=await link('shard',`4 · Key shard ${S.x} of ${n}`,TL.shamir,'Shamir k-of-n',S.y,`${S.y.length.toLocaleString()} bytes · `+hex(S.y.slice(0,16))+'…');d.dataset.x=S.x;d.onclick=()=>d.classList.toggle('picked')} | |
| await link('','5 · Snake tail (seal)',TL.chain,'SHA-512 chain',enc.encode(prev),`${N} AES-256 layers · ${(256*N).toLocaleString()}-bit key · stormed in ${ms} ms · any change breaks every link after it`); | |
| state={sh,ivs,pk,k,N};document.getElementById('rb').style.display='flex'; | |
| }; | |
| document.getElementById('re').onclick=async()=>{ | |
| const out=document.getElementById('out');out.style.display='block'; | |
| const picked=[...document.querySelectorAll('.shard.picked')].map(d=>state.sh.find(s=>s.x==d.dataset.x)); | |
| if(picked.length<state.k){out.textContent=`🔒 ${picked.length} shard(s) — need ${state.k}. Still sealed.`;return} | |
| try{const key=combine(picked);let data=new Uint8Array(state.pk.reduce((a,p)=>a+p.length,0));let o=0;state.pk.forEach(p=>{data.set(p,o);o+=p.length}); | |
| for(let i=state.N-1;i>=0;i--){const a=ALGS[i%4];data=new Uint8Array(await crypto.subtle.decrypt(params(a,state.ivs[i]),await ik(a,key.slice(i*32,i*32+32)),data))} | |
| out.textContent='🧩 Rebuilt: '+decodeURIComponent(escape(atob(dec.decode(data))));}catch(e){out.textContent='🔒 Wrong shards. Still sealed.'} | |
| }; | |
| </script></body></html> | |