Pixtes Hub
Privacy & Security
Strong Password Generator
Generate cryptographically strong passwords locally on your device. Secure, offline-capable, and private.
Generated Password
Securely generated via Window.crypto
Privacy Assurance
This tool runs entirely in your browser. Your password is never sent to any server.
// Logic (Same as before but with UI updates)
const lengthSlider = document.getElementById('length-slider');
const lengthVal = document.getElementById('length-val');
const generateBtn = document.getElementById('generate-btn');
const passwordDisplay = document.getElementById('password-display');
const copyBtn = document.getElementById('copy-btn');
const strengthBar = document.getElementById('strength-bar');
const strengthLabel = document.getElementById('strength-label');
const chars = {
lower: 'abcdefghijklmnopqrstuvwxyz',
upper: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
numbers: '0123456789',
symbols: '!@#$%^&*()_+~`|}{[]:;?><,./-=',
ambiguous: 'il1o0O'
};
lengthSlider.oninput = function() {
lengthVal.textContent = this.value;
};
function generatePassword() {
const length = parseInt(lengthSlider.value);
const includeUpper = document.getElementById('include-uppercase').checked;
const includeNumbers = document.getElementById('include-numbers').checked;
const includeSymbols = document.getElementById('include-symbols').checked;
const avoidAmbiguous = document.getElementById('avoid-ambiguous').checked;
let charset = chars.lower;
if (includeUpper) charset += chars.upper;
if (includeNumbers) charset += chars.numbers;
if (includeSymbols) charset += chars.symbols;
if (avoidAmbiguous) {
for (let char of chars.ambiguous) {
charset = charset.replace(new RegExp(char, 'g'), '');
}
}
let password = '';
const array = new Uint32Array(length);
window.crypto.getRandomValues(array);
for (let i = 0; i < length; i++) {
password += charset[array[i] % charset.length];
}
passwordDisplay.textContent = password;
updateStrength(password);
passwordDisplay.classList.add('text-brand-blue');
setTimeout(() => passwordDisplay.classList.remove('text-brand-blue'), 300);
}
function updateStrength(pwd) {
let strength = 0;
if (pwd.length > 12) strength += 1;
if (pwd.length > 18) strength += 1;
if (/[A-Z]/.test(pwd)) strength += 1;
if (/[0-9]/.test(pwd)) strength += 1;
if (/[^A-Za-z0-9]/.test(pwd)) strength += 1;
const bars = [
{ color: 'bg-red-500', label: 'WEAK', width: '20%' },
{ color: 'bg-orange-500', label: 'WEAK', width: '40%' },
{ color: 'bg-yellow-500', label: 'MEDIUM', width: '60%' },
{ color: 'bg-emerald-500', label: 'STRONG', width: '80%' },
{ color: 'bg-blue-600', label: 'SECURE', width: '100%' }
];
const level = Math.min(strength, 4);
strengthBar.className = `h-full transition-all duration-500 ${bars[level].color}`;
strengthBar.style.width = bars[level].width;
strengthLabel.textContent = bars[level].label;
strengthLabel.className = bars[level].color.replace('bg-', 'text-');
}
generateBtn.addEventListener('click', generatePassword);
copyBtn.addEventListener('click', () => {
const pwd = passwordDisplay.textContent;
if (pwd === '••••••••••••••••') return;
navigator.clipboard.writeText(pwd).then(() => {
const originalIcon = copyBtn.innerHTML;
copyBtn.innerHTML = '';
lucide.createIcons();
setTimeout(() => {
copyBtn.innerHTML = originalIcon;
lucide.createIcons();
}, 2000);
});
});
generatePassword();