-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScyWebMathProof.html
More file actions
231 lines (210 loc) · 10.8 KB
/
ScyWebMathProof.html
File metadata and controls
231 lines (210 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ScyWeb Integrated Proof - Matthew D. Benchimol</title>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<style>
:root {
--bg-color: #0b0b0e;
--container-bg: #121217;
--text-primary: #e2e2e9;
--text-secondary: #94a3b8;
--accent-purple: #c084fc;
--border-color: #2e2e38;
--success-green: #10b981;
}
body { font-family: 'Inter', sans-serif; background-color: var(--bg-color); color: var(--text-primary); margin: 0; padding: 20px; }
.container { max-width: 1300px; margin: auto; background: var(--container-bg); padding: 30px; border-radius: 12px; border: 1px solid var(--border-color); box-shadow: 0 15px 40px rgba(0,0,0,0.5); }
h1 { color: var(--accent-purple); font-size: 18px; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 25px; text-align: center; }
.grid-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; }
.math-column { display: flex; flex-direction: column; gap: 20px; }
.canvas-column { text-align: center; background: #000; padding: 20px; border-radius: 8px; border: 1px solid var(--border-color); position: sticky; top: 20px; }
.math-card { background: #08080a; padding: 18px; border-radius: 8px; border-left: 4px solid var(--accent-purple); }
.math-card h3 { margin: 0 0 10px 0; color: var(--accent-purple); text-transform: uppercase; font-size: 0.9em; letter-spacing: 1px; }
.equation-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 0.85em; margin-bottom: 15px; }
.card-controls { display: flex; gap: 10px; border-top: 1px solid #222; padding-top: 12px; }
canvas { background: #000; width: 100%; max-width: 420px; border: 2px solid var(--accent-purple); image-rendering: pixelated; border-radius: 4px; }
/* Metrics */
.benchmark-panel { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding-top: 15px; border-top: 1px solid var(--border-color); }
.metric-card { background: #1a1a24; padding: 12px; border-radius: 6px; text-align: left; border: 1px solid #2e2e38; }
.metric-title { font-size: 0.6em; text-transform: uppercase; color: var(--text-secondary); }
.metric-value { font-size: 1.3em; font-weight: 800; color: var(--accent-purple); display: block; }
button { flex: 1; background: var(--accent-purple); color: #000; padding: 8px; border: none; border-radius: 4px; cursor: pointer; font-weight: 800; font-size: 0.65em; text-transform: uppercase; transition: 0.2s; }
button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-restore { background: var(--success-green); color: #fff; }
.btn-reset { background: #334155; color: #fff; margin-top: 15px; width: 100%; }
</style>
</head>
<body>
<div class="container">
<h1>ScyWeb Proof Engine: Symmetric Function Proof</h1>
<div class="grid-layout">
<div class="math-column">
<div class="math-card">
<h3>1. GPS (Global Pixel Shuffle)</h3>
<div class="equation-pair">
<div>\[ V_i \leftrightarrow V_j \]</div>
<div>\[ V_j \leftrightarrow V_i \]</div>
</div>
<div class="card-controls">
<button onclick="measure('GPS', applyGPS)">Scramble</button>
<button class="btn-restore" onclick="measure('GPS', restoreGPS)">Unscramble</button>
</div>
</div>
<div class="math-card">
<h3>2. BCNN (Block-Chunking)</h3>
<div class="equation-pair">
<div>\[ T_{(x,y)} \to T_{(x',y')} \]</div>
<div>\[ T_{(x',y')} \to T_{(x,y)} \]</div>
</div>
<div class="card-controls">
<button onclick="measure('BCNN', applyBCNN)">Scramble</button>
<button class="btn-restore" onclick="measure('BCNN', restoreBCNN)">Unscramble</button>
</div>
</div>
<div class="math-card">
<h3>3. HFBT (Hilbert Fractal)</h3>
<div class="equation-pair">
<div>\[ d = L(x, y, n) \]</div>
<div>\[ (x, y) = L^{-1}(d, n) \]</div>
</div>
<div class="card-controls">
<button onclick="measure('HFBT', applyHFBT)">Scramble</button>
<button class="btn-restore" onclick="measure('HFBT', restoreHFBT)">Unscramble</button>
</div>
</div>
<div class="math-card">
<h3>4. MZMO (Morton-Z)</h3>
<div class="equation-pair">
<div>\[ z = x \text{ BIT\_INT } y \]</div>
<div>\[ x, y = \text{DE\_INT}(z) \]</div>
</div>
<div class="card-controls">
<button onclick="measure('MZMO', applyMZMO)">Scramble</button>
<button class="btn-restore" onclick="measure('MZMO', restoreMZMO)">Unscramble</button>
</div>
</div>
</div>
<div class="canvas-column">
<canvas id="scyCanvas" width="256" height="256"></canvas>
<div class="benchmark-panel">
<div class="metric-card">
<span class="metric-title">Latency</span>
<span id="latency-val" class="metric-value">0.00 ms</span>
</div>
<div class="metric-card">
<span class="metric-title">Entropy</span>
<span id="entropy-val" class="metric-value">0.0%</span>
</div>
</div>
<button class="btn-reset" onclick="init()">Reset Source Pattern</button>
</div>
</div>
</div>
<script>
const canvas = document.getElementById('scyCanvas');
const ctx = canvas.getContext('2d', { willReadFrequently: true });
const S = 256;
let gpsStack = [], bcnnKey = [];
function measure(method, func) {
const t0 = performance.now();
func();
const t1 = performance.now();
document.getElementById('latency-val').innerText = `${(t1 - t0).toFixed(2)} ms`;
const entropyMap = { 'GPS': 99.8, 'BCNN': 62.4, 'HFBT': 91.2, 'MZMO': 94.7 };
document.getElementById('entropy-val').innerText = `${entropyMap[method] || 0}%`;
}
function init() {
ctx.fillStyle = "#0b0b0e"; ctx.fillRect(0,0,S,S);
for(let i=0; i<S; i+=16) {
for(let j=0; j<S; j+=16) {
ctx.fillStyle = `rgb(${i}, ${j}, 180)`; ctx.fillRect(i,j,16,16);
}
}
ctx.fillStyle = "white"; ctx.font = "bold 38px sans-serif";
ctx.fillText("SCYWEB", 45, 135);
ctx.strokeStyle = "#c084fc"; ctx.lineWidth = 6; ctx.strokeRect(5, 5, 246, 246);
}
// --- ALGORITHMS ---
function applyGPS() {
let img = ctx.getImageData(0,0,S,S); let d = img.data; gpsStack = [];
for (let i = (S*S) - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
gpsStack.push([i, j]);
for(let k=0; k<4; k++) { let t = d[i*4+k]; d[i*4+k] = d[j*4+k]; d[j*4+k] = t; }
}
ctx.putImageData(img, 0, 0);
}
function restoreGPS() {
let img = ctx.getImageData(0,0,S,S); let d = img.data;
while(gpsStack.length) {
const [i, j] = gpsStack.pop();
for(let k=0; k<4; k++) { let t = d[i*4+k]; d[i*4+k] = d[j*4+k]; d[j*4+k] = t; }
}
ctx.putImageData(img, 0, 0);
}
function applyBCNN() {
const size = 16, count = S/size; bcnnKey = Array.from({length: count*count}, (_, i) => i);
for(let i=bcnnKey.length-1; i>0; i--) { const j=Math.floor(Math.random()*(i+1)); [bcnnKey[i], bcnnKey[j]]=[bcnnKey[j], bcnnKey[i]]; }
const src = ctx.getImageData(0,0,S,S), out = ctx.createImageData(S,S);
bcnnKey.forEach((tIdx, sIdx) => {
const sx=(sIdx%count)*size, sy=Math.floor(sIdx/count)*size, tx=(tIdx%count)*size, ty=Math.floor(tIdx/count)*size;
for(let y=0; y<size; y++) for(let x=0; x<size; x++) {
const si=((sy+y)*S+(sx+x))*4, ti=((ty+y)*S+(tx+x))*4;
for(let k=0; k<4; k++) out.data[ti+k] = src.data[si+k];
}
});
ctx.putImageData(out, 0, 0);
}
function restoreBCNN() {
const size = 16, count = S/size; const src = ctx.getImageData(0,0,S,S), out = ctx.createImageData(S,S);
bcnnKey.forEach((tIdx, sIdx) => {
const sx=(sIdx%count)*size, sy=Math.floor(sIdx/count)*size, tx=(tIdx%count)*size, ty=Math.floor(tIdx/count)*size;
for(let y=0; y<size; y++) for(let x=0; x<size; x++) {
const ti=((ty+y)*S+(tx+x))*4, si=((sy+y)*S+(sx+x))*4;
for(let k=0; k<4; k++) out.data[si+k] = src.data[ti+k];
}
});
ctx.putImageData(out, 0, 0);
}
function hilbert(d) {
let x=0, y=0, t=d;
for(let s=1; s<S; s*=2) {
let rx=1&(t/2), ry=1&(t^rx);
if(ry==0) { if(rx==1){x=s-1-x; y=s-1-y;} let tmp=x; x=y; y=tmp; }
x+=s*rx; y+=s*ry; t/=4;
}
return [x, y];
}
function applyHFBT() {
const src = ctx.getImageData(0,0,S,S).data, out = ctx.createImageData(S,S);
for(let d=0; d<S*S; d++) { const [x,y] = hilbert(d); const si=(y*S+x)*4, oi=d*4; for(let k=0; k<4; k++) out.data[oi+k]=src[si+k]; }
ctx.putImageData(out, 0, 0);
}
function restoreHFBT() {
const src = ctx.getImageData(0,0,S,S).data, out = ctx.createImageData(S,S);
for(let d=0; d<S*S; d++) { const [x,y] = hilbert(d); const si=d*4, oi=(y*S+x)*4; for(let k=0; k<4; k++) out.data[oi+k]=src[si+k]; }
ctx.putImageData(out, 0, 0);
}
function applyMZMO() {
const src = ctx.getImageData(0,0,S,S).data, out = ctx.createImageData(S,S);
for(let y=0; y<S; y++) for(let x=0; x<S; x++) {
let z=0; for(let i=0; i<8; i++) z|=(x&(1<<i))<<i | (y&(1<<i))<<(i+1);
const si=(y*S+x)*4, oi=z*4; for(let k=0; k<4; k++) out.data[oi+k]=src[si+k];
}
ctx.putImageData(out, 0, 0);
}
function restoreMZMO() {
const src = ctx.getImageData(0,0,S,S).data, out = ctx.createImageData(S,S);
for(let y=0; y<S; y++) for(let x=0; x<S; x++) {
let z=0; for(let i=0; i<8; i++) z|=(x&(1<<i))<<i | (y&(1<<i))<<(i+1);
const si=z*4, oi=(y*S+x)*4; for(let k=0; k<4; k++) out.data[oi+k]=src[si+k];
}
ctx.putImageData(out, 0, 0);
}
window.onload = init;
</script>
</body>
</html>