Files
WinnieAPI-v2/public/js/tools/hash.js
T
2026-05-01 20:02:13 +02:00

19 lines
1022 B
JavaScript

// ═══════════════════════════════════════════════════════
// Hash
// ═══════════════════════════════════════════════════════
async function generateHash() {
const text = document.getElementById('hashInput').value;
if (!text) return setStatus('hashStatus','error','Enter text to hash.');
const d = await apiPost('/api/hash', { text });
if (d.success) {
const c = document.getElementById('hashResults');
c.innerHTML = Object.entries(d.hashes).map(([algo, hash]) => `
<div class="result-row">
<div class="label">${algo.toUpperCase()}</div>
<div class="value" onclick="copyText(this.textContent)" title="Click to copy">${hash}</div>
</div>`).join('');
setStatus('hashStatus','success','Generated ✓');
} else setStatus('hashStatus','error', d.error);
}