Bodul / offline.html
mirdax25-ux's picture
Release portable deterministic core 1.1.0: frozen formats, offline recovery and regression checks
54a35ed verified
Raw History Blame Contribute Delete
11.7 kB
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; connect-src 'none'; img-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'">
<title>Bodulski HAL | Offline Matrix</title>
<style>
:root{color-scheme:dark;font-family:system-ui,sans-serif;background:#0b1118;color:#e6edf5}*{box-sizing:border-box}body{margin:0}main{max-width:1080px;margin:auto;padding:42px 24px}h1{font-size:clamp(2rem,5vw,3rem);margin:8px 0 12px}.eyebrow{color:#8de6c3;font-size:.8rem;letter-spacing:.14em;font-weight:700}.lead{color:#b6c6d7;max-width:760px;line-height:1.65}.grid{display:grid;grid-template-columns:1fr 1fr;gap:20px;margin-top:28px}.panel{background:#121d29;border:1px solid #2c3d50;border-radius:16px;padding:22px}label{display:block;margin-bottom:8px;font-weight:600}textarea,input{font:inherit;color:inherit;background:#09131e;border:1px solid #456075;border-radius:8px;padding:12px;width:100%;margin-bottom:20px}textarea{resize:vertical;min-height:160px}input{font-family:ui-monospace,monospace}button,a.button{font:inherit;font-weight:650;border-radius:8px;padding:11px 15px;border:1px solid #4c6d78;background:#172b36;color:#e6edf5;cursor:pointer;text-decoration:none;display:inline-block}button.primary{background:#8de6c3;border-color:#8de6c3;color:#09251b}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible{outline:3px solid #b5c7ff;outline-offset:3px}.actions{display:flex;gap:9px;flex-wrap:wrap}button:disabled{opacity:.45;cursor:default}pre{white-space:pre-wrap;overflow-wrap:anywhere;font:13px/1.65 ui-monospace,monospace;margin:0}h2{font-size:1rem;margin-top:0}.note{font-size:.85rem;line-height:1.6;color:#b6c6d7}.status{color:#8de6c3;margin-top:16px;min-height:24px}footer{margin-top:26px;color:#b6c6d7;font-size:.85rem;line-height:1.7}a{color:#8de6c3}code{color:#c1d8ff}@media(max-width:760px){.grid{grid-template-columns:1fr}main{padding:28px 16px}}
</style></head><body><main>
<div class="eyebrow">BODULSKI HAL / PORTABLE EXECUTION</div>
<h1>A checksum you can reproduce.</h1>
<p class="lead">Normalize text and compute its UTC-date SHA-256 checksum. This page is a single file: no installation, external scripts, API keys or network requests. Save it and open it locally whenever you need it.</p>
<div class="grid"><section class="panel" aria-label="Checksum inputs">
<label for="payload">Input text</label><textarea id="payload" spellcheck="false">Evidence before confidence.</textarea>
<label for="at">Explicit timestamp with timezone</label><input id="at" value="2026-11-03T12:00:00+00:00" autocomplete="off" spellcheck="false">
<div class="actions"><button id="compute" class="primary" type="button">Compute checksum</button><button id="sample" type="button">Known vector</button><button id="boundary" type="button">UTC boundary</button><button id="empty" type="button">Empty input</button><button id="selftest" type="button">Run self-tests</button></div>
<p class="note">The explicit time is intentional: the result can be reproduced without relying on a future system clock. Input limit: 1 MiB UTF-8. Format <code>bodul-matrix-v1</code>; normalization <code>bodul-whitespace-v1</code>.</p>
</section><section class="panel" aria-label="Structured checksum result"><h2>Structured result</h2><pre id="output" aria-live="polite">Choose Compute checksum to begin.</pre><div class="actions" style="margin-top:20px"><button id="download" type="button" disabled>Save result.json</button></div><p id="status" class="status" role="status"></p></section></div>
<footer><strong>Scope:</strong> <code>valid: true</code> means non-empty, valid text within the input limit. The checksum does not authenticate a source, establish truth or authorize an action. Anyone can recompute it. Full timestamps and engine versions are metadata outside the checksum.<br>
Reference: Matrix Core 3.6.0-OMEGA 路 Apache-2.0 路 Damir Balenovi膰. The downloadable Python archive also contains the supplied-evidence verifier and tests. <a href="bodul-offline-1.1.0.zip" download>Download the complete offline source archive</a> 路 <a href="index.html">Open the evidence playground</a></footer>
</main><script>
"use strict";
(function () {
const VERSION="3.6.0-OMEGA", FORMAT="bodul-matrix-v1", PROFILE="bodul-whitespace-v1", LIMIT=1048576;
const WHITE=[9,10,11,12,13,28,29,30,31,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];
const separators=new RegExp("["+WHITE.map(n=>String.fromCharCode(n)).join("")+"]+","g");
const encoder=new TextEncoder();
function normalize(text){return text.replace(separators," ").replace(/^ +| +$/g,"");}
function scalarText(text){for(let i=0;i<text.length;i++){const c=text.charCodeAt(i);if(c>=0xd800&&c<=0xdbff){const d=text.charCodeAt(++i);if(!(d>=0xdc00&&d<=0xdfff))return false;}else if(c>=0xdc00&&c<=0xdfff)return false;}return true;}
function pad(n,len){return String(n).padStart(len||2,"0");}
function instant(raw){
const m=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.([0-9]{1,6}))?(Z|[+-][0-9]{2}:[0-9]{2})$/.exec(raw);
if(!m||m[8]==="-00:00")throw Error("Use a complete timestamp with a known UTC offset.");
const [y,mo,d,h,mi,s]=m.slice(1,7).map(Number), z=m[8];
if(y<1||mo<1||mo>12||d<1||d>31||h>23||mi>59||s>59)throw Error("Invalid Gregorian timestamp.");
const value=new Date(0);value.setUTCFullYear(y,mo-1,d);value.setUTCHours(h,mi,s,0);
if(value.getUTCFullYear()!==y||value.getUTCMonth()!==mo-1||value.getUTCDate()!==d)throw Error("Invalid Gregorian date.");
let offset=0;
if(z!=="Z"){const oh=Number(z.slice(1,3)),om=Number(z.slice(4));if(oh>23||om>59)throw Error("Invalid UTC offset.");offset=(oh*60+om)*(z[0]==="-"?-1:1);}
value.setTime(value.getTime()-offset*60000);
const year=value.getUTCFullYear();if(year<1||year>9999)throw Error("Supported UTC years are 0001 through 9999.");
const date=pad(year,4)+"-"+pad(value.getUTCMonth()+1)+"-"+pad(value.getUTCDate());
const micro=(m[7]||"").padEnd(6,"0");
return {date:date,timestamp:date+"T"+pad(value.getUTCHours())+":"+pad(value.getUTCMinutes())+":"+pad(value.getUTCSeconds())+(Number(micro)?"."+micro:"")+"+00:00"};
}
// SHA-256 compression from the published FIPS 180-4 algorithm. This is a
// checksum implementation, not a cryptographic certification or signature.
const K=[0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2];
function rr(n,s){return(n>>>s)|(n<<(32-s));}
function sha256(bytes){
const length=bytes.length,total=Math.ceil((length+9)/64)*64,data=new Uint8Array(total);data.set(bytes);data[length]=128;
const view=new DataView(data.buffer);view.setUint32(total-8,Math.floor(length/536870912),false);view.setUint32(total-4,(length*8)>>>0,false);
const state=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19],w=new Int32Array(64);
for(let p=0;p<total;p+=64){
for(let i=0;i<16;i++)w[i]=view.getInt32(p+i*4,false);
for(let i=16;i<64;i++){const a=w[i-15],b=w[i-2];w[i]=(w[i-16]+(rr(a,7)^rr(a,18)^(a>>>3))+w[i-7]+(rr(b,17)^rr(b,19)^(b>>>10)))|0;}
let [a,b,c,d,e,f,g,h]=state;
for(let i=0;i<64;i++){const t1=(h+(rr(e,6)^rr(e,11)^rr(e,25))+((e&f)^(~e&g))+K[i]+w[i])|0,t2=((rr(a,2)^rr(a,13)^rr(a,22))+((a&b)^(a&c)^(b&c)))|0;h=g;g=f;f=e;e=(d+t1)|0;d=c;c=b;b=a;a=(t1+t2)|0;}
[a,b,c,d,e,f,g,h].forEach((v,i)=>{state[i]=(state[i]+v)|0;});
}
return state.map(v=>(v>>>0).toString(16).padStart(8,"0")).join("");
}
function compute(text,at){
let time;try{time=instant(at);}catch(error){return{valid:false,error:"INVALID_TIMESTAMP",detail:error.message};}
const meta={timestamp:time.timestamp,engine_version:VERSION,checksum_format:FORMAT,normalization_profile:PROFILE,hash_algorithm:"sha256"};
if(typeof text!=="string")return Object.assign({valid:false,error:"EMPTY_OR_INVALID_PAYLOAD"},meta);
if(!scalarText(text))return Object.assign({valid:false,error:"INVALID_UNICODE"},meta);
if(text.length>LIMIT||encoder.encode(text).length>LIMIT)return Object.assign({valid:false,error:"PAYLOAD_TOO_LARGE"},meta);
const clean=normalize(text);if(!clean)return Object.assign({valid:false,error:"EMPTY_OR_INVALID_PAYLOAD"},meta);
const raw="BODUL_MATRIX::"+clean+"::"+time.date+"::OMEGA_FLOW";
return Object.assign({valid:true,input_payload:clean,seal_date:time.date,matrix_verification_seal:sha256(encoder.encode(raw))},meta);
}
const KNOWN="36e7be60a50a6d846b8b162c199a5e534c612ba171163d9c3406e2f2b12c0651";
function selftest(){
const tests=[sha256(encoder.encode(""))==="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",sha256(encoder.encode("abc"))==="ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",compute("Evidence before confidence.","2026-11-03T12:00:00Z").matrix_verification_seal===KNOWN,compute(" Evidence\u00a0before\nconfidence. ","2026-11-04T00:30:00+02:00").matrix_verification_seal===KNOWN,compute(" ","2026-11-03T12:00:00Z").valid===false,compute("x","2100-02-29T00:00:00Z").valid===false,compute("x","2126-11-03T12:00:00Z").valid===true,compute("x","2400-02-29T00:00:00Z").valid===true,compute("\ud800","2026-11-03T12:00:00Z").error==="INVALID_UNICODE"];
return{passed:tests.every(Boolean),checks:tests.length,scope:"local checksum vectors, Unicode and Gregorian boundary fixtures"};
}
const el=id=>document.getElementById(id);let last=null;
function show(){last=compute(el("payload").value,el("at").value);el("output").textContent=JSON.stringify(last,null,2);el("download").disabled=!last.valid;el("status").textContent=last.valid?"Checksum computed locally. No network request was made.":"Input rejected: "+last.error;}
function fixture(kind){el("payload").value=kind==="empty"?" \t\n":"Evidence before confidence.";el("at").value=kind==="boundary"?"2026-11-04T00:30:00+02:00":"2026-11-03T12:00:00+00:00";show();}
el("compute").addEventListener("click",show);el("sample").addEventListener("click",()=>fixture("sample"));el("boundary").addEventListener("click",()=>fixture("boundary"));el("empty").addEventListener("click",()=>fixture("empty"));
el("selftest").addEventListener("click",()=>{el("output").textContent=JSON.stringify(selftest(),null,2);el("status").textContent="Self-tests completed locally.";last=null;el("download").disabled=true;});
el("download").addEventListener("click",()=>{if(!last||!last.valid)return;const url=URL.createObjectURL(new Blob([JSON.stringify(last,null,2)+"\n"],{type:"application/json;charset=utf-8"})),a=document.createElement("a");a.href=url;a.download="matrix-result.json";a.click();setTimeout(()=>URL.revokeObjectURL(url),1000);});
window.BodulMatrix=Object.freeze({compute:compute,sha256:sha256,selftest:selftest,format:FORMAT,version:VERSION,whitespace:WHITE.slice()});
}());
</script></body></html>