You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
406 B
13 lines
406 B
11 months ago
|
import hashlib
|
||
|
|
||
|
#hash co md5 de un texto
|
||
|
Texto = "Texto de prueba".encode("utf-8")
|
||
|
HashCode= hashlib.md5(Texto).hexdigest()
|
||
|
print("El hash de %s es: %s" % (Texto , HashCode))
|
||
|
|
||
|
#hash con md5 de un fichero
|
||
|
filename = input("Nombre de fichero: ")
|
||
|
with open(filename,"rb") as f:
|
||
|
bytes = f.read()
|
||
|
HashCode = hashlib.md5(bytes).hexdigest();
|
||
|
print("El hash del fichero: %s es:\n%s" % (filename ,HashCode))
|