Frage

I'm trying to use the inbuilt ripemd160 and md4 provided by Openssl to generate hash. This is my code

import hashlib
c = input("Enter: ")
c = c.encode('utf-8')
h = hashlib.new('ripemd160')
d = h.update(c)
print(d.hexdigest())

But this give me an error

AttributeError: 'NoneType' object has no attribute 'hexdigest'

War es hilfreich?

Lösung

update() do not return the digest. Digest is generated by digest() or hexdigest()

h.update(c)
print(h.hexdigest())
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top