py-md4

RSA MD4 Message-Digest Algorithm

RSA Data Security, Inc. MD4 Message-Digest Algorithm (RFC1320) for Python

An nearly exact duplicate of the standard Python MD5 module, just with a different algorithm. Even the documentation is almost identical - just replace 'md5' with 'md4' in the appropriate places.

Useful for making Samba NT Password hashes.

import md4
passwd = 'mygreatpasswd'
print md4.new(passwd.encode('utf-16le')).hexdigest().upper()

Should print: CFACF72F5EB60EA15F89E3AF66732545


Note that in Python 2.5, the new hashlib module may be able to pick up an MD4 implementation from an underlying OpenSSL library, depending on your installation. If that's the case, this code should give the same result as the code above:

import hashlib
passwd = 'mygreatpasswd'
print hashlib.new('md4', passwd.encode('utf-16le')).hexdigest().upper()

if that works, you probably don't need this module.


See also: Dmitry Rozmanov's pure-Python md4 module

Repositories

Releases

1.0
Files: