SHA Hash Generator



Advanced SHA Hash Generator


Generate real-time SHA-1, SHA-256, or SHA-512 hashes with live preview, QR code, and file export features.














Generated Hash:


 













copyright src="https://cdn.jsdelivr.net/npm/[email protected]/copyright-js.min.js">copyright src="https://cdn.jsdelivr.net/npm/qrcodejs/qrcode.min.js">
copyright>// function generateHash() {
const input = document.getElementById('inputText').value.trim();
const type = document.getElementById('hashType').value;
let hash = '';

if (!input) {
alert("Please enter text to hash.");
return;
}

switch (type) {
case 'SHA-1':
hash = CryptoJS.SHA1(input).toString();
break;
case 'SHA-256':
hash = CryptoJS.SHA256(input).toString();
break;
case 'SHA-512':
hash = CryptoJS.SHA512(input).toString();
break;
}

document.getElementById('outputHash').value = hash;

// QR Code
const qrDiv = document.getElementById('qrCode');
qrDiv.innerHTML = '';
new QRCode(qrDiv, {
text: hash,
width: 150,
height: 150,
colorDark: "#000",
colorLight: "#fff",
correctLevel: QRCode.CorrectLevel.H
});
}

document.getElementById('inputText').addEventListener('input', generateHash);
document.getElementById('hashType').addEventListener('change', generateHash);

function copyHash() {
const output = document.getElementById('outputHash');
if (!output.value.trim()) return alert("No hash to copy.");
output.select();
document.execCommand('copy');
alert("Hash copied!");
}

function clearFields() {
document.getElementById('inputText').value = "";
document.getElementById('outputHash').value = "";
document.getElementById('qrCode').innerHTML = "";
}

function downloadFile(type) {
const hash = document.getElementById('outputHash').value.trim();
const originalText = document.getElementById('inputText').value.trim();
if (!hash) return alert("Nothing to export!");

let content, filename, blob;

if (type === 'txt') {
content = hash;
filename = 'hash.txt';
blob = new Blob([content], { type: 'text/plain' });
} else {
content = JSON.stringify({ input: originalText, hash: hash }, null, 2);
filename = 'hash.json';
blob = new Blob([content], { type: 'application/json' });
}

const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = filename;
a.click();
URL.revokeObjectURL(url);
}
// ]]>



About This SHA Hash Generator


This tool helps you securely generate SHA-1, SHA-256, or SHA-512 hashes. It provides live previews, QR generation, and export functionality, ideal for verifying file integrity or cryptographic needs.
SHA Hash Generator

???? How to Use



  • Type or paste your content into the input box.

  • Select your desired hash algorithm.

  • View the live hash and corresponding QR code.

  • Copy or export your hash easily.


???? Pro Tips



  • Use SHA-256 for most web applications.

  • Export hashes for secure offline storage.

  • QR codes simplify mobile transfers and validation.


Leave a Reply

Your email address will not be published. Required fields are marked *