TypeError: object supporting the buffer API required

1
import hashlib
from sys import exit

def md5():
hash1=input("Dame el codigo MD5 : ")
Identificador=1
with open ("diccionarios/rockyou.txt") as f:
    abrir=f.readline().strip()
    for contraseña in abrir :
        md5archivo=hashlib.md5(contraseña.split()).hexdigest()
        print("Comprobando contraseña %s : %s" % (Identificador ,contraseña.split()))
        Identificador+=1
        if md5archivo == hash1:
            print("La contraseña es" ,  contraseña)
    else:
        print("No se encontro la password")
md5()
  

Traceback (most recent call last): File "md5cracker.py", line 17, in          md5 () File "md5cracker.py", line 10, in md5       md5file = hashlib.md5 (password.split ()). hexdigest () TypeError: object supporting the buffer API required

The code in terms of spaces, is messy. Does anyone know any solution to this?

    
asked by x5678 05.01.2018 в 01:05
source

1 answer

0
    for contraseña in abrir :
    md5archivo=hashlib.md5(contraseña.split()).hexdigest()
    print("Comprobando contraseña %s : %s" % (Identificador ,contraseña.split()))

Changing by strip gave another error:      TypeError: Unicode-objects must be encoded before hashing

    
answered by 05.01.2018 в 01:12