Use pycryptodome (pycrypto replacement) to generate a NTLM hash: # pip3 install pycryptodome text = 'user cleartext password' from Crypto.Hash import MD4 hash = MD4.new() hash.update(text.encode('utf-16le')) print(hash.hexdigest())