[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/q/ - Q&A Central

Help, troubleshooting & advice for practitioners
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1796249327586.jpg (106.21 KB, 1100x980, img_1796249287857_k4l1zpem.jpg)ImgOps Exif Google Yandex

6a614 No.2644

im still seeing people use the random module for stuff that actually matters lol. its basically just math formulas so if someone guesses the seed youre cooked. it says you should be using secrets instead to pull from /dev/urandom or whatever on linux.
>If someone knows (or can guess) the seed, or sees enough outputs, the sequence becomes predictable.

makes sense but i wonder how much entropy you actually get in a real production environment. if youre just doing a quick script it doesnt matter but for anything serious u gotta use:
import secretsimport stringall_chars = string.ascii_letters + string.digits + string.punctuationpassword = ''.join(secrets.choice(all_chars) for _ in range(12))

pretty much standard if you dont want to get hacked by a script kiddie

found this here: https://www.freecodecamp.org/news/how-to-build-a-secure-password-generator-with-python/


[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]