Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- const CONFIG = {
- DEFAULT_LEN: 40,
- BATCH_SIZE: 8000,
- MAX_STORED: 1000,
- PAGE_SIZE: 5,
- UI: {
- PRIMARY: "#6e57ff",
- ACCENT: "#0fa",
- BG: "#0a0a0a",
- HEADER_BG: "#111",
- TEXT_MAIN: "#0f0",
- TEXT_LIGHT: "#fff",
- BORDER: "#222",
- GLOW: "0 0 30px #6e57ff66"
- },
- COORDS: {
- NICE: { x: 69420, y: -69420 },
- MYTHIC_NEAR: 100,
- MYTHIC_FAR: 199900
- }
- };
- const ID = 'final-twin-hud';
- if (window.WF_INIT) return (document.getElementById(ID)?.remove(), window.WF_INIT = 0);
- window.WF_INIT = 1;
- // Core variables
- let workers = [], urls = [], scanning = 0, paused = 0, buffer = [], cmap = new Map();
- let total = 0, lastH = 0, lastT = performance.now();
- let anyLength = false, currentPage = 0, pageSize = CONFIG.PAGE_SIZE, needsRender = false;
- let stats = { ax: 0, tw: 0, ni: 0, my: 0 };
- let sortMode = 'count';
- let dr = 0, ox, oy;
- // Updated Logic String (Lr_01, Lr_02, Lr)
- const LrS = `
- function Lr_01(seed) {
- let key = [], s = [], j = 0, i = 0;
- seed = seed + "";
- for (let k = 0; k < seed.length; k++) {
- key[k & 255] = (key[k & 255] || 0) ^ seed.charCodeAt(k);
- }
- let keyLen = key.length || 1;
- for (let n = 0; n < 256; n++) s[n] = n;
- for (let n = 0; n < 256; n++) {
- j = (j + s[n] + key[n % keyLen]) & 255;
- [s[n], s[j]] = [s[j], s[n]];
- }
- function byte() {
- i = (i + 1) & 255;
- j = (j + s[i]) & 255;
- [s[i], s[j]] = [s[j], s[i]];
- return s[(s[i] + s[j]) & 255];
- }
- return function rand() {
- let num = 0, denom = 1;
- for (let k = 0; k < 6; k++) {
- num = num * 256 + byte();
- denom *= 256;
- }
- return num / denom;
- };
- }
- function Lr_02(str) {
- let tpl = { maxX: 100000, maxY: 100000, text: str };
- let m = str.match(/^\\[(.*?)\\](.*)$/);
- if (!m) return tpl;
- let params = m[1].split(",");
- tpl.text = m[2];
- for (let p of params) {
- let [k, v] = p.split("=");
- if (!k || v == null) continue;
- k = k.trim(); v = v.trim();
- if (k === "maxX") tpl.maxX = Number(Math.min(v, 274000000));
- if (k === "maxY") tpl.maxY = Number(Math.min(v, 275000000));
- }
- return tpl;
- }
- function Lr(input) {
- input = decodeURI((input || "").trim());
- if (!input) return { x: 0, y: 0 };
- let tpl = Lr_02(input);
- let rand = Lr_01(input);
- function axis(max, snap) {
- let raw = Math.round(2 * max * rand()) - max;
- return snap * Math.round(raw / snap);
- }
- return { x: axis(tpl.maxX, 20), y: axis(tpl.maxY, 10) };
- }
- `;
- // UI Construction
- const hud = document.createElement('div');
- hud.id = ID;
- hud.style = `position:fixed;top:50px;right:20px;width:340px;background:${CONFIG.UI.BG};color:${CONFIG.UI.TEXT_MAIN};border:2px solid ${CONFIG.UI.PRIMARY};border-radius:12px;z-index:9999999;font-family:monospace;box-shadow:${CONFIG.UI.GLOW};display:flex;flex-direction:column;overflow:hidden;user-select:none`;
- hud.innerHTML = `
- <div id="wf-d" style="padding:12px;background:${CONFIG.UI.HEADER_BG};cursor:move;font-size:11px;display:flex;justify-content:space-between;border-bottom:1px solid ${CONFIG.UI.BORDER}">
- <span>walls found: <span id="wf-f" style="color:${CONFIG.UI.ACCENT}">(0)</span> <span id="wf-h" style="color:${CONFIG.UI.PRIMARY}">[0]</span></span>
- <div style="display:flex;gap:5px"><button id="wf-r" style="background:#222;color:${CONFIG.UI.TEXT_MAIN};border:1px solid #444;font-size:9px;cursor:pointer;padding:0 6px">RESTART</button><button id="wf-x" style="background:#411;color:#fff;border:none;cursor:pointer;width:20px;border-radius:4px">X</button></div>
- </div>
- <div style="padding:15px;display:flex;flex-direction:column;gap:10px">
- <div id="wf-s" style="font-size:14px;font-weight:bold;color:${CONFIG.UI.TEXT_LIGHT};text-align:center">0 HPS</div>
- <div style="background:${CONFIG.UI.HEADER_BG};height:4px;border-radius:2px;overflow:hidden"><div id="wf-p" style="width:0;height:100%;background:${CONFIG.UI.PRIMARY}"></div></div>
- <div style="background:${CONFIG.UI.HEADER_BG};padding:10px;border-radius:4px;font-size:10px;border:1px solid ${CONFIG.UI.BORDER}">
- <div style="display:flex;justify-content:space-between;color:${CONFIG.UI.TEXT_LIGHT};margin-bottom:4px">
- <span>MAX LENGTH: <span id="l-v" style="color:${CONFIG.UI.PRIMARY}">${CONFIG.DEFAULT_LEN}</span></span>
- <button id="wf-al" style="background:#222;color:${CONFIG.UI.PRIMARY};border:1px solid #444;font-size:9px;padding:1px 4px;cursor:pointer;border-radius:3px">ANY LENGTH: OFF</button>
- </div>
- <input type="range" id="wf-l" min="1" max="100" value="${CONFIG.DEFAULT_LEN}" style="width:100%;accent-color:${CONFIG.UI.PRIMARY};margin-bottom:10px">
- <div style="display:flex;flex-direction:column;gap:5px;margin-bottom:10px">
- <div style="display:flex;align-items:center;gap:8px"><input type="text" id="wf-q" placeholder="Target Word..." style="flex:1;background:#000;border:1px solid #333;color:${CONFIG.UI.TEXT_MAIN};padding:5px;font-size:11px;outline:none;border-radius:4px"><span id="wf-c" style="color:${CONFIG.UI.PRIMARY};font-weight:bold">(0)</span></div>
- <input type="text" id="wf-cp" placeholder="Custom Char Pool..." style="background:#000;border:1px solid #333;color:${CONFIG.UI.ACCENT};padding:5px;font-size:11px;outline:none;border-radius:4px">
- </div>
- <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;color:${CONFIG.UI.TEXT_LIGHT}">PLACEMENT: <select id="wf-pl" style="background:${CONFIG.UI.HEADER_BG};color:${CONFIG.UI.TEXT_MAIN};border:1px solid #333;font-size:10px;padding:2px"><option value="both">Both Sides</option><option value="before">Before Only</option><option value="after">After Only</option></select></div>
- <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;color:${CONFIG.UI.TEXT_LIGHT}">SORT BY: <button id="wf-st" style="background:#222;color:${CONFIG.UI.PRIMARY};border:1px solid #444;font-size:9px;padding:2px 6px;cursor:pointer;border-radius:3px;min-width:80px">MOST FOUND</button></div>
- <div style="display:flex;justify-content:space-between;color:${CONFIG.UI.TEXT_LIGHT};text-align:center;font-size:9px">
- <label style="display:flex;flex-direction:column;align-items:center;gap:2px"><input type="checkbox" id="wf-ax"> AXIS<span id="st-ax" style="color:${CONFIG.UI.PRIMARY}">(0)</span></label>
- <label style="display:flex;flex-direction:column;align-items:center;gap:2px"><input type="checkbox" id="wf-tw" checked> TWIN<span id="st-tw" style="color:${CONFIG.UI.PRIMARY}">(0)</span></label>
- <label style="display:flex;flex-direction:column;align-items:center;gap:2px"><input type="checkbox" id="wf-ni"> NICE<span id="st-ni" style="color:${CONFIG.UI.PRIMARY}">(0)</span></label>
- <label style="display:flex;flex-direction:column;align-items:center;gap:2px"><input type="checkbox" id="wf-my"> MYTHIC<span id="st-my" style="color:${CONFIG.UI.PRIMARY}">(0)</span></label>
- </div>
- </div>
- <button id="wf-t" style="padding:10px;background:${CONFIG.UI.PRIMARY};color:${CONFIG.UI.TEXT_LIGHT};border:none;border-radius:4px;cursor:pointer;font-weight:bold">START SCAN</button>
- <div style="display:flex;gap:5px"><button id="wf-ca" style="flex:1;padding:8px;background:${CONFIG.UI.HEADER_BG};color:${CONFIG.UI.ACCENT};border:1px solid ${CONFIG.UI.BORDER};border-radius:4px;cursor:pointer;font-size:10px;font-weight:bold">COPY ALL</button><button id="wf-cl" style="flex:1;padding:8px;background:${CONFIG.UI.HEADER_BG};color:#f44;border:1px solid ${CONFIG.UI.BORDER};border-radius:4px;cursor:pointer;font-size:10px;font-weight:bold">CLEAR</button></div>
- <div style="display:flex;justify-content:space-between;align-items:center;padding:5px 0;background:#000;border-top:1px solid ${CONFIG.UI.BORDER}">
- <button id="wf-prev" style="background:#222;color:${CONFIG.UI.TEXT_LIGHT};border:1px solid #444;padding:4px 8px;cursor:pointer;font-size:10px;border-radius:4px">< PREV</button>
- <span id="wf-pg" style="font-size:10px;color:${CONFIG.UI.PRIMARY}">PAGE: 1</span>
- <button id="wf-next" style="background:#222;color:${CONFIG.UI.TEXT_LIGHT};border:1px solid #444;padding:4px 8px;cursor:pointer;font-size:10px;border-radius:4px">NEXT ></button>
- </div>
- <div id="wf-res" style="max-height:250px;min-height:100px;overflow-y:auto;border-top:1px solid ${CONFIG.UI.BORDER};background:#000;user-select:text"></div>
- </div>`;
- document.body.appendChild(hud);
- const getE = id => document.getElementById(id);
- // Worker Logic
- const blob = () => new Blob([`${LrS}
- const norm = "abcdefghijklmnopqrstuvwxyz0123456789".split("");
- const unic = Array.from({length:500},(_,i)=>String.fromCharCode(i+192));
- onmessage=e=>{
- const {batch,len,q,ax,tw,my,ni,p,pl,anyLen,cfg,pool} = e.data; if(p) return;
- const h=[];
- const customPool = pool ? [...pool] : null;
- for(let i=0;i<batch;i++){
- let w=q||"", useUnic=Math.random()>0.5;
- let targetLen = anyLen ? Math.floor(Math.random() * len) + 1 : len;
- while([...w].length<targetLen){
- let activePool = customPool ? customPool : (useUnic ? unic : norm);
- let c=activePool[Math.random()*activePool.length|0];
- if(pl == 'before') { w = c + w; }
- else if(pl == 'after') { w = w + c; }
- else { w = Math.random() > 0.5 ? c + w : w + c; }
- useUnic=!useUnic;
- }
- const o=Lr(w),s=Math.abs(o.x)+Math.abs(o.y),isNi=(o.x==cfg.COORDS.NICE.x||o.y==cfg.COORDS.NICE.y);
- const isAx=(o.x==0||o.y==0), isTw=(Math.abs(o.x)==Math.abs(o.y)), isMy=(s<cfg.COORDS.MYTHIC_NEAR||s>cfg.COORDS.MYTHIC_FAR);
- if((ax&&isAx)||(tw&&isTw)||(my&&isMy)||(ni&&isNi)) {
- h.push({w, k:\`\${o.x},\${-o.y}\`, d:o.x*o.x+o.y*o.y, n:isNi, ax:isAx, tw:isTw, my:isMy});
- }
- }
- postMessage({h,batch});
- }`], { type: "application/javascript" });
- // Rest of initialization logic (Init, Stats, Rendering, Events, Dragging)
- const init = () => {
- workers.forEach(w => w.terminate());
- urls.forEach(u => URL.revokeObjectURL(u));
- workers = [], urls = [];
- const cores = Math.max(2, navigator.hardwareConcurrency || 4);
- for (let i = 0; i < cores; i++) {
- let u = URL.createObjectURL(blob());
- urls.push(u);
- let w = new Worker(u);
- w.onmessage = e => {
- if (!scanning) return;
- total += e.data.batch;
- if (e.data.h?.length && !paused) {
- buffer.push(...e.data.h);
- needsRender = true;
- }
- send(w);
- };
- workers.push(w);
- }
- };
- const send = w => w.postMessage({
- batch: CONFIG.BATCH_SIZE, len: +getE('wf-l').value, q: getE('wf-q').value,
- pool: getE('wf-cp').value, pl: getE('wf-pl').value, ax: getE('wf-ax').checked,
- tw: getE('wf-tw').checked, my: getE('wf-my').checked, ni: getE('wf-ni').checked,
- p: paused, anyLen: anyLength, cfg: CONFIG
- });
- const updateStats = () => {
- getE('st-ax').innerText = `(${stats.ax})`;
- getE('st-tw').innerText = `(${stats.tw})`;
- getE('st-ni').innerText = `(${stats.ni})`;
- getE('st-my').innerText = `(${stats.my})`;
- };
- const renderResults = () => {
- const container = getE('wf-res');
- const fragment = document.createDocumentFragment();
- const allCoords = Array.from(cmap.entries()).sort((a, b) => {
- if (sortMode === 'count') return b[1].words.length - a[1].words.length;
- return a[1].d - b[1].d;
- });
- const pageItems = allCoords.slice(currentPage * pageSize, (currentPage + 1) * pageSize);
- pageItems.forEach(([k, data]) => {
- const {words, d, n, ax, tw, my} = data;
- const t = n ? "NICE" : tw ? "TWIN" : ax ? "AXIS" : my ? "MYTHIC" : "NRML";
- const c = n ? "#f0f" : `hsl(${Math.max(0,120-(Math.sqrt(d)/141421)*120)},100%,50%)`;
- const r = document.createElement('div');
- r.style = `padding:6px 8px;border-bottom:1px solid #111;font-size:10px;cursor:pointer;border-left:4px solid ${c};display:flex;align-items:flex-start;justify-content:space-between`;
- r.innerHTML = `<div style="flex:1;overflow:hidden;word-break:break-all;white-space:normal;padding-right:10px"><span style="color:${c};font-weight:bold">[${t}]</span>: <span style="color:${CONFIG.UI.PRIMARY}">(${k})</span>: <span style="color:${CONFIG.UI.TEXT_LIGHT}">(${words.length})</span> <span style="color:${CONFIG.UI.ACCENT}">(${words[0]})</span></div><button class="cs" style="background:#222;color:${CONFIG.UI.TEXT_LIGHT};border:1px solid #444;font-size:8px;padding:2px 4px;cursor:pointer;border-radius:3px;flex-shrink:0">SEED</button>`;
- r.onclick = e => {
- if (e.target.classList.contains('cs')) {
- navigator.clipboard.writeText(`(${k})\n[${t}]: (${words.length})\n${words.map(w => '/' + w).join('\n')}`);
- e.target.innerText = "COPIED!";
- setTimeout(() => e.target.innerText = "SEED", 800);
- } else {
- navigator.clipboard.writeText(`[${t}]: (${k}): (${words.length}) ${words.map(v=>`(${v})`).join(' ')}`);
- }
- };
- fragment.appendChild(r);
- });
- container.innerHTML = "";
- container.appendChild(fragment);
- getE('wf-pg').innerText = `PAGE: ${currentPage + 1} / ${Math.ceil(cmap.size / pageSize) || 1}`;
- needsRender = false;
- };
- const loop = () => {
- if (!scanning || !getE(ID)) return;
- let now = performance.now();
- if (!paused && buffer.length) {
- let slice = buffer.splice(0, 200);
- for (let h of slice) {
- if (!cmap.has(h.k)) {
- if (cmap.size < CONFIG.MAX_STORED) {
- cmap.set(h.k, { words: [h.w], d: h.d, n: h.n, ax: h.ax, tw: h.tw, my: h.my });
- if (h.n) stats.ni++; if (h.tw) stats.tw++; if (h.ax) stats.ax++; if (h.my) stats.my++;
- updateStats();
- if (cmap.size >= CONFIG.MAX_STORED) {
- scanning = false;
- getE('wf-t').innerText = "START SCAN";
- break;
- }
- }
- } else {
- let data = cmap.get(h.k);
- if (!data.words.includes(h.w)) data.words.push(h.w);
- }
- }
- if (needsRender) renderResults();
- getE('wf-f').innerText = `(${cmap.size})`;
- const progress = (cmap.size / CONFIG.MAX_STORED) * 100;
- getE('wf-p').style.width = Math.min(100, progress) + '%';
- }
- if (now - lastT > 1000) {
- getE('wf-s').innerText = Math.round(total - lastH).toLocaleString() + ' HPS';
- getE('wf-h').innerText = `[${total.toLocaleString()}]`;
- lastT = now; lastH = total;
- }
- requestAnimationFrame(loop);
- };
- // UI Listeners
- getE('wf-prev').onclick = () => { if (currentPage > 0) { currentPage--; renderResults(); } };
- getE('wf-next').onclick = () => { if ((currentPage + 1) * pageSize < cmap.size) { currentPage++; renderResults(); } };
- getE('wf-t').onclick = e => {
- scanning = !scanning;
- e.target.innerText = scanning ? "STOP SCAN" : "START SCAN";
- if (scanning) { workers.forEach(send); loop(); }
- };
- getE('wf-r').onclick = () => {
- cmap.clear(); buffer = []; stats={ax:0,tw:0,ni:0,my:0}; updateStats();
- getE('wf-res').innerHTML = ""; total = lastH = 0; currentPage = 0; init();
- };
- getE('wf-cl').onclick = () => {
- cmap.clear(); buffer = []; stats={ax:0,tw:0,ni:0,my:0}; updateStats();
- getE('wf-res').innerHTML = ""; getE('wf-f').innerText = "(0)"; currentPage = 0; renderResults();
- };
- getE('wf-ca').onclick = () => {
- let rows = Array.from(cmap.entries()).sort((a,b) => b[1].words.length - a[1].words.length).map(([k, data]) => {
- let type = data.n ? "NICE" : data.tw ? "TWIN" : data.ax ? "AXIS" : data.my ? "MYTHIC" : "NRML";
- return `[${type}]: (${k}): (${data.words.length}) ${data.words.map(v=>`(${v})`).join(' ')}`;
- });
- navigator.clipboard.writeText(rows.join('\n'));
- };
- getE('wf-x').onclick = () => {
- workers.forEach(w => w.terminate());
- urls.forEach(u => URL.revokeObjectURL(u));
- hud.remove(); window.WF_INIT = 0;
- };
- getE('wf-l').oninput = e => getE('l-v').innerText = e.target.value;
- getE('wf-q').oninput = e => getE('wf-c').innerText = `(${e.target.value.length})`;
- getE('wf-al').onclick = e => {
- anyLength = !anyLength;
- e.target.innerText = `ANY LENGTH: ${anyLength ? "ON" : "OFF"}`;
- e.target.style.color = anyLength ? CONFIG.UI.ACCENT : CONFIG.UI.PRIMARY;
- getE('wf-l').style.opacity = anyLength ? "0.5" : "1";
- };
- getE('wf-st').onclick = e => {
- sortMode = sortMode === 'count' ? 'dist' : 'count';
- e.target.innerText = sortMode === 'count' ? "MOST FOUND" : "DISTANCE";
- renderResults();
- };
- getE('wf-d').onmousedown = e => {
- dr = 1; ox = hud.offsetLeft - e.clientX;
- oy = hud.offsetTop - e.clientY; hud.style.right = 'auto';
- };
- window.addEventListener('mousemove', e => {
- if (dr) {
- hud.style.left = (e.clientX + ox) + 'px';
- hud.style.top = (e.clientY + oy) + 'px';
- }
- });
- window.addEventListener('mouseup', () => dr = 0);
- init();
- })();
Advertisement
Comments
-
- In case your wondering what HPS is, HPS stands for Hashes Per Second. It's the primary metric for measuring the speed and efficiency of the scanner. Essentially, it tells you how many unique "guesses" (strings) the computer is generating and checking against the coordinate algorithm every second.
-
- you should add a category for center walls :D
-
Comment was deleted
Add Comment
Please, Sign In to add comment