Código de Python - Programa para mostrar valores hash a partir de texto.

Requerimientos

Librerías usadas: hashlib, colorama

0.1
estrellaestrellaestrellaestrellaestrella(2)

Publicado el 8 de Noviembre del 2022gráfica de visualizaciones de la versión: 0.1
982 visualizaciones desde el 8 de Noviembre del 2022
estrellaestrellaestrellaestrellaestrella
estrellaestrellaestrellaestrella
estrellaestrellaestrella
estrellaestrella
estrella

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import hashlib
from colorama import Fore, Back, init
 
class HASH:
    def generateHash(h):
        digest=h.hexdigest()
        return digest
 
init()
algoritmos = ["md5","sha1","sha224","sha256","sha384","sha512"]
 
print(Back.BLUE+"-"*56+"HASH CLI"+"-"*56+Back.RESET)
while True:
    print(Fore.GREEN+"Elija número de opción deseada:")
    print("1-Genererar hash usando algoritmo MD5")
    print("2-Genererar hash usando algoritmo SHA1")
    print("3-Genererar hash usando algoritmo SHA224")
    print("4-Genererar hash usando algoritmo SHA256")
    print("5-Genererar hash usando algoritmo SHA384")
    print("6-Genererar hash usando algoritmo SHA512")
    print("7-Finalizar programa.")
 
    try:
        nAlgoritmo = int(input("Introducir opción: "))
 
        if nAlgoritmo > 0 and nAlgoritmo < 8:
 
            if nAlgoritmo != 7:
                datos=input("Introducir información a hashear: ")
                algoritmo = algoritmos[nAlgoritmo-1]
                bdatos = bytes(datos, 'utf-8')
                h = hashlib.new(algoritmo,bdatos)
                hash1=HASH.generateHash(h)
                print(Fore.BLUE+f"\nALGORITMO: {algoritmo.upper()}"+Fore.RESET)
                print(Fore.YELLOW+hash1+Fore.RESET+"\n")
            else:
                break
        else:
            print("\n"+Back.RED+Fore.BLACK+"VALOR FUERA DE RANGO."+Fore.RESET+Back.RESET+"\n")
 
    except Exception as e:
        print("\n"+Back.RED+Fore.BLACK+str(e)+Fore.RESET+Back.RESET+"\n")
 
print("PROGRAM FINISHED")



Comentarios sobre la versión: 0.1 (2)

Imágen de perfil
10 de Noviembre del 2022
estrellaestrellaestrellaestrellaestrella
Buen script en Python. Gracias
Responder
Imágen de perfil
10 de Noviembre del 2022
estrellaestrellaestrellaestrellaestrella
Gracias a usted, por su comentario :)
Responder

Comentar la versión: 0.1

Nombre
Correo (no se visualiza en la web)
Valoración
Comentarios...
CerrarCerrar
CerrarCerrar
Cerrar

Tienes que ser un usuario registrado para poder insertar imágenes, archivos y/o videos.

Puedes registrarte o validarte desde aquí.

Codigo
Negrita
Subrayado
Tachado
Cursiva
Insertar enlace
Imagen externa
Emoticon
Tabular
Centrar
Titulo
Linea
Disminuir
Aumentar
Vista preliminar
sonreir
dientes
lengua
guiño
enfadado
confundido
llorar
avergonzado
sorprendido
triste
sol
estrella
jarra
camara
taza de cafe
email
beso
bombilla
amor
mal
bien
Es necesario revisar y aceptar las políticas de privacidad

http://lwp-l.com/s7307