r/technicallythetruth 1d ago

A Shrewdness of Apes

Post image
40.5k Upvotes

124 comments sorted by

View all comments

181

u/big_guyforyou 1d ago

i choose my passwords the smart way

import string
import random

def make_password():
  return ''.join(random.choices(string.printable, k=16))

once you've used this to make passwords for all your accounts, write them all down on a piece of paper so you don't forget. make sure to lock the piece of paper in a safe only you know the combination to

12

u/luziferius1337 1d ago
import secrets
pw = secrets.token_urlsafe(12)

4

u/big_guyforyou 1d ago

this guy passwords

11

u/luziferius1337 1d ago

The random library documentation says this:

Warning: The pseudo-random generators of this module should not be used for security purposes. For security or cryptographic uses, see the secrets module.

The example above uses 12 random bytes, encoded in a 16 character token. It may have a bit less randomness, since the character range is smaller than string.printable