You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# secrets — Generate secure random numbers for managing secrets.
# The secrets module is used for generating cryptographically strong random numbers suitable for managing data such as passwords, account authentication,
# security tokens, and related secrets.
#
#
# In particularly, secrets should be used in preference to the default pseudo-random number generator in the random module, which is designed for modelling
# and simulation, not security or cryptography.
#
#
# Using secrets to manage a basic level of security.
# Generate an eight-character alphanumeric password:
#
import string
alphabet = string.ascii_letters + string.digits
password = ''.join(choice(alphabet) for i in range(8))
#
# Note:
# Applications should not store passwords in a recoverable format, whether plain text or encrypted.
# They should be salted and hashed using a cryptographically-strong one-way (irreversible) hash function.