Skip to content

Commit 0ab2304

Browse files
authored
Add files via upload
1 parent 6d7d742 commit 0ab2304

1 file changed

Lines changed: 48 additions & 8 deletions

File tree

multi_cipher_v2_5.html

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<head>
55
<meta charset="UTF-8">
6-
<title>🔐 Multi-Cipher Cracker v2.5.1</title>
6+
<title>🔐 Multi-Cipher Cracker v2.5.2</title>
77
<style>
88
* { box-sizing: border-box; }
99
body {
@@ -115,6 +115,8 @@
115115
.worker-box { background: #0a1a2a; border: 1px solid #333; border-radius: 8px; padding: 10px; text-align: center; }
116116
.worker-box.active { border-color: #ffd700; background: #1a1a0a; }
117117
.worker-box.done { border-color: #00ff88; background: #0a1a0a; }
118+
.worker-box.highscore { border-color: #ff6b6b; background: #2a0a1a; animation: pulse-high 0.5s ease; }
119+
@keyframes pulse-high { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
118120
.worker-name { font-size: 11px; color: #00ffff; font-weight: bold; margin-bottom: 5px; }
119121
.worker-info { font-size: 10px; color: #888; }
120122
.worker-cases { font-size: 12px; color: #ffd700; margin-top: 3px; }
@@ -124,7 +126,7 @@
124126

125127
<div class="container">
126128
<h1>🔐 Multi-Cipher Cracker</h1>
127-
<div class="version">v2.5.1 <span class="new-badge">Force 2-3-4 + Live</span></div>
129+
<div class="version">v2.5.2 <span class="new-badge">Live High Scores ≥70%</span></div>
128130
<p class="subtitle">
129131
<span class="worker-status">
130132
<span class="worker-dot" id="workerDot"></span>
@@ -356,20 +358,35 @@ <h2>⚙️ Options</h2>
356358
// WORKER VIGENÈRE
357359
// ============================================================
358360
const vigenereWorkerCode = commonCode + `
361+
const HIGH_SCORE_THRESHOLD = 70;
362+
let lastPartialTime = 0;
363+
359364
self.onmessage = function(e) {
360365
const { action, text, options } = e.data;
361366
if (action !== 'crack') return;
362367
const { lang, minScore, keyLengths } = options;
363368
let all = [];
364369
let casesTotal = 0;
370+
let bestScore = 0;
365371
366372
for (const len of keyLengths) {
367373
let count = 0;
368374
for (const key of vigenereKeys(len, text)) {
369375
casesTotal++;
370376
const d = vigenere(text, key);
371377
const sc = score(d, lang);
372-
if (sc.score >= minScore) all.push({ cipher: 'Vigenère', key, text: d, ...sc });
378+
if (sc.score >= minScore) {
379+
const result = { cipher: 'Vigenère', key, text: d, ...sc };
380+
all.push(result);
381+
382+
// Envoyer immédiatement les HIGH SCORES (throttle 200ms)
383+
const now = Date.now();
384+
if (sc.score >= HIGH_SCORE_THRESHOLD && sc.score > bestScore && (now - lastPartialTime > 200)) {
385+
bestScore = sc.score;
386+
lastPartialTime = now;
387+
self.postMessage({ action: 'partial', result, cases: casesTotal });
388+
}
389+
}
373390
count++;
374391
if (count % 10000 === 0) self.postMessage({ action: 'progress', cipher: 'Vigenère L=' + len, cases: casesTotal });
375392
if (count > 12000000) break;
@@ -385,20 +402,35 @@ <h2>⚙️ Options</h2>
385402
// WORKER BEAUFORT
386403
// ============================================================
387404
const beaufortWorkerCode = commonCode + `
405+
const HIGH_SCORE_THRESHOLD = 70;
406+
let lastPartialTime = 0;
407+
388408
self.onmessage = function(e) {
389409
const { action, text, options } = e.data;
390410
if (action !== 'crack') return;
391411
const { lang, minScore, keyLengths } = options;
392412
let all = [];
393413
let casesTotal = 0;
414+
let bestScore = 0;
394415
395416
for (const len of keyLengths) {
396417
let count = 0;
397418
for (const key of vigenereKeys(len, text)) {
398419
casesTotal++;
399420
const d = beaufort(text, key);
400421
const sc = score(d, lang);
401-
if (sc.score >= minScore) all.push({ cipher: 'Beaufort', key, text: d, ...sc });
422+
if (sc.score >= minScore) {
423+
const result = { cipher: 'Beaufort', key, text: d, ...sc };
424+
all.push(result);
425+
426+
// Envoyer immédiatement les HIGH SCORES (throttle 200ms)
427+
const now = Date.now();
428+
if (sc.score >= HIGH_SCORE_THRESHOLD && sc.score > bestScore && (now - lastPartialTime > 200)) {
429+
bestScore = sc.score;
430+
lastPartialTime = now;
431+
self.postMessage({ action: 'partial', result, cases: casesTotal });
432+
}
433+
}
402434
count++;
403435
if (count % 10000 === 0) self.postMessage({ action: 'progress', cipher: 'Beaufort L=' + len, cases: casesTotal });
404436
if (count > 12000000) break;
@@ -608,20 +640,27 @@ <h2>⚙️ Options</h2>
608640
}
609641

610642
function handleWorkerMessage(workerId, data) {
611-
const { action, results, cipher, cases, finalCases } = data;
643+
const { action, results, result, cipher, cases, finalCases } = data;
612644
const elapsed = (Date.now() - crackStartTime) / 1000;
613645

614646
if (action === 'progress') {
615647
workerStats[workerId].cases = cases;
616648
updateWorkerUI(workerId, cipher, cases, elapsed);
617649
updateGlobalProgress();
650+
} else if (action === 'partial') {
651+
// HIGH SCORE trouvé ! Ajouter et afficher immédiatement
652+
workerStats[workerId].cases = cases;
653+
allResults.push(result);
654+
updateWorkerUI(workerId, `🎯 ${result.score.toFixed(0)}% ${result.key}`, cases, elapsed, false, true);
655+
updateGlobalProgress();
656+
displayLiveResults();
618657
} else if (action === 'results') {
619658
workerStats[workerId].cases = finalCases;
620659
workerStats[workerId].done = true;
621660
allResults.push(...results);
622661
pendingWorkers--;
623662

624-
updateWorkerUI(workerId, 'Terminé', finalCases, elapsed, true);
663+
updateWorkerUI(workerId, 'Terminé', finalCases, elapsed, true, false);
625664
updateGlobalProgress();
626665

627666
// Afficher les résultats en LIVE dès qu'un worker termine
@@ -633,14 +672,15 @@ <h2>⚙️ Options</h2>
633672
}
634673
}
635674

636-
function updateWorkerUI(workerId, info, cases, elapsed, done = false) {
675+
function updateWorkerUI(workerId, info, cases, elapsed, done = false, highscore = false) {
637676
const nameMap = { vig: 'Vig', beau: 'Beau', std: 'Std' };
638677
const boxEl = document.getElementById('worker' + nameMap[workerId]);
639678
const infoEl = document.getElementById('worker' + nameMap[workerId] + 'Info');
640679
const casesEl = document.getElementById('worker' + nameMap[workerId] + 'Cases');
641680

642-
boxEl.classList.toggle('active', !done);
681+
boxEl.classList.toggle('active', !done && !highscore);
643682
boxEl.classList.toggle('done', done);
683+
boxEl.classList.toggle('highscore', highscore && !done);
644684
infoEl.textContent = info;
645685

646686
const cps = elapsed > 0 ? Math.round(cases / elapsed) : 0;

0 commit comments

Comments
 (0)