Created
July 18, 2019 15:46
-
-
Save parzibyte/81a4056c8c1627935bdf82d01ee91d65 to your computer and use it in GitHub Desktop.
Generar cadena aleatoria segura en Python https://parzibyte.me/blog/2018/12/06/contrasena-segura-python/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Generar una contraseña o cadena aleatoria y segura criptográficamente | |
Visita: parzibyte.me/blog | |
""" | |
from secrets import choice | |
caracteres = 'abcdefghijklmnopqrtsuvwxyz1234567890' | |
longitud = 8 # La longitud que queremos | |
cadena_aleatoria = ''.join(choice(caracteres) for caracter in range(longitud)) | |
print("La cadena es: ", cadena_aleatoria) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment