Generate MD4 Hash using Python

pycryptodome package

  1. Install pycryptodome package from the command line:
pip install pycryptodome
  1. Generate MD4 hash:
from Crypto.Hash import MD4

text = 'Hello'
hashObject ='utf-8'))
digest = hashObject.hexdigest()


hashlib library

import hashlib

text = 'Hello'
hashObject ='md4', text.encode('utf-8'))
digest = hashObject.hexdigest()


Note: MD4 hash function availability in hashlib library depends on OpenSSL library that Python uses on specific platform. In OpenSSL 3, MD4 is marked as legacy and not available by default.

Leave a Comment

Cancel reply

Your email address will not be published.