improved da fuck out of passggen

This commit is contained in:
2026-07-13 02:07:37 -06:00
parent 036c985592
commit 657f515135
+126 -21
View File
@@ -1,11 +1,11 @@
<html>
<head>
<title>Passgen</title>
<title>Passgen 0.2.9</title>
<script>
var alphau = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
var alphal = "abcdefghijklmnopqrstuvwxyz";
var numbers = "0123456789";
var symbols = "`~!@#$%^&*()-=_+[]\{}|;':\",./<>?";
var symbols = "`~!@#$%^&*()-=_+[]\{}|;':\",./<>?\\";
var space = " ";
var baseYear = 120000000000000000000000;
@@ -15,6 +15,27 @@ function $id(id) {
}
async function copyInputToClipboard(inputId, buttonElement) {
const inputElement = document.getElementById(inputId);
if (!inputElement) return;
try {
await navigator.clipboard.writeText(inputElement.value);
} catch (err) {
inputElement.select();
document.execCommand('copy');
}
// Temporary button label change
if (buttonElement) {
const originalText = buttonElement.innerText;
buttonElement.innerText = 'Copied!';
setTimeout(() => {
buttonElement.innerText = originalText;
}, 2000);
}
}
function secureRand(min,max,len) {
var str = "";
var rand = [];
@@ -43,7 +64,6 @@ function generatepass(len,keys){
}
return rlist;
}
@@ -53,8 +73,8 @@ function entropy(chars,len) {
// chars = length of charset
//len = length of password
//base = total md5 tries per year
// len = length of password
// base = total md5 tries per year
// TODO: Assumes power doubles every 18 months (Moore's law)
function yearsToCrack(chars,len,base) {
possible = Math.pow(chars,len);
@@ -71,30 +91,115 @@ function generate() {
if($id('numbers').checked) { keylist += numbers; }
if($id('space').checked) { keylist += space; }
$id('out').innerHTML = generatepass(len,keylist);
$id('out').value = generatepass(len,keylist);
$id('entropy').innerHTML = entropy(keylist.length,len);
$id('years').innerHTML = yearsToCrack(keylist.length,len,baseYear);
}
window.onload = function(){generate();}
</script>
<style>
* { font-family: verdana; }
h1 { margin-bottom: 5px; }
a:link { color: black; }
a:hover { text-decoration:none; }
* {
font-family: 'Courier New', Courier, monospace;
font-weight: bold;
}
body {
background-color: #FFFFFF;
}
h1 {
margin-bottom: 5px;
}
a:link {
color: #000000;
}
a:hover {
text-decoration:none;
}
/* Base link styling */
.has-tooltip {
position: relative; /* Crucial for positioning the tooltip relative to the link */
text-decoration: underline;
cursor: pointer;
}
/* Tooltip container (text box) */
.has-tooltip::before {
content: attr(data-tooltip); /* Pulls text from the data-tooltip attribute */
position: absolute;
bottom: 100%; /* Positions the box above the top of the link */
left: 50%;
transform: translateX(-50%) translateY(-8px); /* Centers horizontally & lifts up slightly */
/* Visual styling */
background-color: #1e293b;
color: #ffffff;
padding: 6px 12px;
border-radius: 6px;
font-size: 0.85rem;
white-space: nowrap; /* Prevents text from wrapping */
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
/* Hide by default */
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease, transform 0.2s ease;
pointer-events: none; /* Prevents cursor interference */
z-index: 100;
}
/* Tooltip arrow pointer */
.has-tooltip::after {
content: '';
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%) translateY(0);
/* Creates a small downward arrow using border tricks */
border-width: 6px 6px 0 6px;
border-style: solid;
border-color: #1e293b transparent transparent transparent;
/* Hide by default */
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease, transform 0.2s ease;
pointer-events: none;
z-index: 100;
}
/* Hover State - Reveal Tooltip & Arrow */
.has-tooltip:hover::before,
.has-tooltip:hover::after {
opacity: 1;
visibility: visible;
}
/* Subtle upward slide animation on hover */
.has-tooltip:hover::before {
transform: translateX(-20%) translateY(-12px);
}
.has-tooltip:hover::after {
transform: translateX(-20%) translateY(-6px);
}
</style>
</head>
<body>
<h1>Passgen<sup><a href="javascript:alert('Passgen 0.2.8\nCryptographically secure password generator\n\nHere is how passgen protects you:\n* Uses a cryptographically secure random number generator to\ngenerate a properly random secure password\n* Nothing is ever sent to anyone! It all runs through your browser\n* Even visiting a website and loading pages from it is not needed\npassgen can run through a bookmarklet without even being online\n* Nothing is ever, ever stored or logged\n* The web page you got this from keeps no logs including IP logs or even a hit counter\n* The website you got this from is secured with TLS to ensure this bookmarklet was not tampered with in transit\n* This bookmarklet code is singed with PGP to guarantee it has not been tampered with by a hacker\n\nPrincess Pi - https://git.thecoven.info/PrincessPi');">?</a></sup></h1>
<input type="checkbox" id="alphal" onchange="generate()" checked> <label for="alphal">Lowercase Letters</label><br>
<input type="checkbox" id="alphau" onchange="generate()" checked> <label for="alphau">Uppercase Letters</label><br>
<input type="checkbox" id="numbers" onchange="generate()" checked> <label for="numbers">Numbers</label><br>
<input type="checkbox" id="symbols" onchange="generate()" checked> <label for="symbols">Symbols</label><br>
<input type="checkbox" id="space" onchange="generate()" checked> <label for="space">Space</label><br>
<label for="length">Length</label> <input type="text" id="length" size="4" value="23" onchange="generate()"><br>
<input type="button" value="Generate" onclick="generate()"> <input type="button" value="Close" onclick="window.close()">
<p><b>Password</b> <span id="out"></span></p>
<p><b>Strength<sup><a href="javascript:alert('Bits of entropy.\nlog2(characters^length)');">?</a></sup></b> <span id="entropy"></span> bits</p>
<p><b>Years to Crack<sup><a href="javascript:alert('Assumes all computing power on Earth being used collaboratively, doubling in power every 18 months.\nAlso assumes a weak, cryptologically broken hash, MD5. (EXCLUDES colissions in MD5)')">?</a></sup></b> <span id="years"></span></p>
<h1>Passgen<sup><a href="javascript:alert('Passgen 0.2.9\nCryptographically secure password generator\n\nHere is how passgen protects you:\n* Uses a cryptographically secure random number generator to\ngenerate a properly random secure password\n* Nothing is ever sent to anyone! It all runs through your browser\n* Even visiting a website and loading pages from it is not needed\npassgen can run through a bookmarklet without even being online\n* Nothing is ever, ever stored or logged\n* The web page you got this from keeps no logs including IP logs or even a hit counter\n* The website you got this from is secured with TLS to ensure this bookmarklet was not tampered with in transit\n* This bookmarklet code is singed with PGP to guarantee it has not been tampered with by a hacker\n\nPrincess Pi - https://git.thecoven.info/PrincessPi');">?</a></sup></h1>
<input type="checkbox" id="alphal" onchange="generate()" checked> <label for="alphal">Lowercase Letters</label><a href="#" class="has-tooltip" data-tooltip="abcdefghijklmnopqrstuvwxyz">?</a><br>
<input type="checkbox" id="alphau" onchange="generate()" checked> <label for="alphau">Uppercase Letters</label><a href="#" class="has-tooltip" data-tooltip="ABCDEFGHIJKLMNOPQRSTUVWXYZ">?</a><br>
<input type="checkbox" id="numbers" onchange="generate()" checked> <label for="numbers">Numbers</label><a href="#" class="has-tooltip" data-tooltip="0123456789">?</a><br>
<input type="checkbox" id="symbols" onchange="generate()" checked> <label for="symbols">Symbols</label><a href="#" class="has-tooltip" data-tooltip="`~!@#$%^&*()-=_+[]\{}|;':&quot;,.&lt;>?\">?</a><br>
<input type="checkbox" id="space" onchange="generate()" checked> <label for="space">Space</label><a href="#" class="has-tooltip" data-tooltip="Space AKA 0x20, \\s, %20, and &amp;nbsp;">?</a><br>
<label for="length">Length</label> <input type="text" id="length" size="4" value="23" onchange="generate()"><br><br>
<button value="Generate" onclick="generate()">Generate New</button> <!--<input type="button" value="Close" onclick="window.close()">-->
<p><b>Password</b> <input type="text" id="out" size="40" readonly> <button onclick="copyInputToClipboard('out', this)">Copy</button></p>
<p><b>Strength<sup><a href="#" class="has-tooltip" data-tooltip="Bits of entropy. log2(characters^length)">?</a></sup></b> <span id="entropy"></span> bits</p>
<p><b>Years to Crack<sup><a href="#" class="has-tooltip" data-tooltip="WORK IN PROGRESS&#x0A;&#x0D;Assumes all computing power on Earth being used collaboratively, doubling in power every 18 months.&#x0A;&#x0D;Also assumes a weak hash, MD5. (EXCLUDES collisions in MD5)">?</a></sup></b> <span id="years"></span></p>
</body>
</html>