Password Generator — create a secure random password
A long, random password is the first line of defense for any account: pick a length and a complexity level here and get one generated **on your own device**, with a cryptographically secure generator (Python's `secrets` module) — no password ever leaves your browser.
What it records
- Password length, e.g. 16
- Complexity level...
How it works
This is a Reactive app: a plain text document that your browser turns into a working app — forms, live data, tables, statistics and even charts, with nothing to install or configure.
- Use it right away. Hit “Use this app”: it opens right in your browser, ready to go, with data saved only on your device.
- Your data stays yours. Everything is stored locally on your device, kept separate for each app: no account, no server, nothing to set up.
- Make it your own. The text below is the entire app: copy it, tweak fields, views and words, and your changes become interactive instantly.
- Share it as a file. An app is a simple file: save it, export it or share it with a link; and with encrypted collaboration several people edit the same data in real time.
The app’s source
# 🔐 Password Generator
A long, random password is the first line of defense for any account:
pick a length and a complexity level here and get one generated **on your
own device**, with a cryptographically secure generator (Python's
`secrets` module) — no password ever leaves your browser.
::::form{path="requests" id="fpw"}
::input{form="fpw" field="length" type="number" placeholder="Password length, e.g. 16" required="true"}
:::select{form="fpw" field="level" placeholder="Complexity level..."}
- Letters and numbers
- Letters, numbers and symbols
:::
::add-form{form="fpw" path="requests" label="Generate password"}
::::
:::python{data="requests"}
```python
import secrets
import string
righe = data["requests"]
if righe:
r = righe[-1]
lunghezza = int(r["length"])
livello = r["level"]
alfabeto = string.ascii_letters + string.digits
if livello == "Letters, numbers and symbols":
alfabeto += string.punctuation
if lunghezza > 0:
pw = "".join(secrets.choice(alfabeto) for _ in range(lunghezza))
print(f"Generated password: `{pw}`")
else:
print("Enter a length greater than zero.")
```
:::
## Previous requests
To avoid leaving passwords in plain sight on the page, the table below
only keeps a history of the length and level requested: the generated
password is shown only in the box above, for the most recent request.
:::table{path="requests" headers="Length,Level" deletable="true"}
{length} | {level}
:::
Use a different password for every account: reusing one everywhere
defeats the whole point of making it long and random.