17

My code looks as follows:

md = input("MD5 Hash: ")
if len(md) != 32:
    print("Don't MD5 Hash.")
else:
    liste = input("Wordlist: ")
    ac = open(liste).readlines()
    for new in ac:
        new = new.split()
        hs = hashlib.md5(new).hexdigest()
        if hs == md:
            print("MD5 HASH CRACKED : ",new)
        else:
            print("Sorry :( Don't Cracked.")

But, I get this error when I run it:

    hs = hashlib.md5(new).hexdigest()
TypeError: object supporting the buffer API required

How do I solve this? "b" bytes?

1 Answer 1

14

Whatever the case, by calling split() on new you create a list object and not an str; lists do not support the Buffer API. Maybe you were looking for strip() in order to remove any trailing/leading white space?

Either way, the resulting str from new.strip() (or split() if you select an element of the resulting list) should be encoded since unicode objects must be encoded before feeding it to a hashing algorithms' initializer.

new = new.strip() # or new.split()[index]
hs = hashlib.md5(new.encode()).hexdigest()
Sign up to request clarification or add additional context in comments.

2 Comments

'new=new.strip()' to delete these space but don't working why?
If you're working with Pandas, having null (NaN) values can cause this error too, so you may need to handle those values before you run them through.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.