Password Generator Password Length: Include Lower Case (a-z) Include Upper Case (A-Z) Include Numbers (0-9) Include Symbols (!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~) Exclude Ambiguous Characters (iIl1L| o0O `'-_":;.,) Exclude Brackets (<>()[]{}) No Repeated Characters Save Settings Saved! body { font-family: Arial, sans-serif; background-color: #f4f4f4; padding: 20px; } .panel { background-color: #ffffff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } input[type="checkbox"] { margin-right: 10px; } .verybigtext { font-size: 24px; color: #333; margin: 15px 0; } #resultid { font-size: 18px; margin-top: 20px; } /* Button styles for Copy Password and Regenerate */ .action-button { display: inline-block; padding: 10px 15px; font-size: 16px; text-decoration: none; border: none; border-radius: 5px; background-color: #17a2b8; /* Change color as necessary */ color: white; cursor: pointer; box-shadow: 0 2px 5px rgba(23, 162, 184, 0.3); margin: 5px; transition: background-color 0.3s, box-shadow 0.3s; } /* Highlight effect */ .action-button:hover { background-color: #138496; /* Darker shade for hover */ box-shadow: 0 4px 10px rgba(23, 162, 184, 0.5); } /* Responsive style */ @media (max-width: 600px) { h2 { font-size: 20px; } } function genMathRand() { if (window.crypto) { var tempGRArray = new Uint32Array(1); return (window.crypto.getRandomValues(tempGRArray) / 65536 / 65536); } else { return Math.random(); } } function saveSettings() { var frm = document.passForm; var cvalue = ''; cvalue += frm.ilower.checked ? '1' : '0'; cvalue += frm.iupper.checked ? '1' : '0'; cvalue += frm.inumber.checked ? '1' : '0'; cvalue += frm.isymbol.checked ? '1' : '0'; cvalue += frm.iexclude.checked ? '1' : '0'; cvalue += frm.iexcludeb.checked ? '1' : '0'; cvalue += frm.iunique.checked ? '1' : '0'; cvalue += frm.lennumber.value; var d = new Date(); d.setTime(d.getTime() + (100 * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = "password-g=" + cvalue + ";" + expires + ";path=/"; document.getElementById("ssout").innerHTML = 'Saved!'; return false; } function doInput(diin) { var frm = document.passForm; if (diin < 4) { frm.lenrange.value = 4; frm.lennumber.value = 4; } else if (diin > 64) { frm.lenrange.value = 64; frm.lennumber.value = 64; } else { frm.lenrange.value = diin; } generatePass(); } function doSliding(dsin) { var frm = document.passForm; frm.lennumber.value = dsin; generatePass(); } function htmlEncode(s) { var el = document.createElement("div"); el.innerText = el.textContent = s; s = el.innerHTML; return s; } function getOneChar(gocIn) { var gocLen = gocIn.length; var gocInd = Math.floor((genMathRand() * gocLen)); if (gocLen == gocInd) gocInd = Math.floor((genMathRand() * (gocLen - 1))); return gocIn.substr(gocInd, 1); } var pCounter = 0; function generatePass() { pCounter = 0; document.getElementById("ssout").innerHTML=''; setTimeout(delayAndProcessPass, 50); return false; } function delayAndProcessPass() { if ((pCounter++) < 20) { var frm = document.passForm; var baseStr = ""; var thisStr = ""; var passGen = ''; if (frm.ilower.checked) { if (frm.iexclude.checked) { thisStr = "abcdefghjkmnpqrstuvwxyz"; } else { thisStr = "abcdefghijklmnopqrstuvwxyz"; } var thisChar = getOneChar(thisStr); passGen += thisChar; if (frm.iunique.checked) thisStr = thisStr.replace(thisChar, ""); baseStr += thisStr; } if (frm.iupper.checked) { if (frm.iexclude.checked) { thisStr = "ABCDEFGHJKMNPQRSTUVWXYZ"; } else { thisStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; } var thisChar = getOneChar(thisStr); passGen += thisChar; if (frm.iunique.checked) thisStr = thisStr.replace(thisChar, ""); baseStr += thisStr; } if (frm.inumber.checked) { if (frm.iexclude.checked) { thisStr = "123456789"; } else { thisStr = "0123456789"; } var thisChar = getOneChar(thisStr); passGen += thisChar; if (frm.iunique.checked) thisStr = thisStr.replace(thisChar, ""); baseStr += thisStr; } if (frm.isymbol.checked) { if (frm.iexcludeb.checked) { if (frm.iexclude.checked) { thisStr = "!#$%&*+/=?@^~"; } else { thisStr = "!\"#$%&'*+,-./:;=?@^_`|~"; } } else { if (frm.iexclude.checked) { thisStr = "!#$%&()*+/?@[\\]^{}~"; } else { thisStr = "!\"#$%&'()*+,-./:;?@[\\]^_`{|}~"; } } var thisChar = getOneChar(thisStr); passGen += thisChar; if (frm.iunique.checked) thisStr = thisStr.replace(thisChar, ""); baseStr += thisStr; } var outVal = 'Result'; if (baseStr.length < 1) { outVal += 'Please include at least one character set for the password to be based on.'; pCounter = 100; } else { var passLen = frm.lennumber.value; var startLen = passGen.length; if ((frm.iunique.checked) && ((baseStr.length + startLen) < passLen)) { outVal += 'Not enough characters to generate such a long non-repeating password.'; pCounter = 100; } else { var tempPass = passGen; for (var i = startLen; i < passLen; i++) { var tempChar = getOneChar(baseStr); tempPass += tempChar; if (frm.iunique.checked) baseStr = baseStr.replace(tempChar, ""); } passGen = ""; for (var i = 0; i < passLen; i++) { var tempChar = getOneChar(tempPass); passGen += tempChar; tempPass = tempPass.replace(tempChar, ""); } var possibilityNum = 1; if (frm.iunique.checked) { var tempTotalLen = passGen.length + baseStr.length; for (var i = 0; i < passGen.length; i++) { possibilityNum *= tempTotalLen; tempTotalLen--; } } else { possibilityNum = Math.pow(baseStr.length, passGen.length); } var pEntropy = Math.log(possibilityNum) / Math.LN2; outVal += '' + htmlEncode(passGen) + ''; pEntropy = Math.round(pEntropy * 10) / 10; outVal += 'Password Strength:'; // Password Strength Indicators if (pEntropy < 36) { outVal += 'Very Weak'; } else if (pEntropy < 48) { outVal += 'Weak'; } else if (pEntropy < 60) { outVal += 'Good'; } else if (pEntropy < 120) { outVal += 'Strong'; } else { outVal += 'Very Strong'; } outVal += 'Password Entropy:' + pEntropy + ' bits'; outVal += 'Copy Password Regenerate'; } } document.getElementById("resultid").innerHTML = outVal; setTimeout(delayAndProcessPass, 50); } return false; } function copyStringToClipboard(str) { var cstcel = document.createElement('textarea'); cstcel.value = atob(str); cstcel.setAttribute('readonly', ''); cstcel.style = { position: 'absolute', left: '-9999px' }; document.body.appendChild(cstcel); cstcel.select(); document.execCommand('copy'); document.body.removeChild(cstcel); return false; } generatePass();