How to calculate NTLM hash in python?
12,793
You can make use of the hashlib and binascii modules to compute your NTLM hash:
import binascii, hashlib
input_str = "SOMETHING_AS_INPUT_TO_HASH"
ntlm_hash = binascii.hexlify(hashlib.new('md4', input_str.encode('utf-16le')).digest())
print ntlm_hash
![SuB](https://i.stack.imgur.com/AaFzA.jpg?s=256&g=1)
Comments
-
SuB almost 2 years
How can I calculate NTLM hash of a passowrd in python? Is there any library or sample code?
I want it for writing a NTLM brute force tools with python (Like Cain & Abel )
-
CppLearner over 11 yearswhy not this? pythonhosted.org/passlib/lib/passlib.hash.nthash.html not familiar with NTLM hash at already.
-
Tuxdude over 11 years
passlib
is a separate python package, butbinascii
andhashlib
are part of the standard python library. Not saying you should not usepasslib
, it is upto the author's preference. There are other libraries as well likepython-ntlm
. -
CppLearner over 11 yearsThanks. interesting how OP checked the other guy. He just copy and paste from an online source code and you being the first one didn't get checked.