Skip to content

Instantly share code, notes, and snippets.

@fumiyas
Created May 13, 2014 08:52
Show Gist options
  • Save fumiyas/9b3a927b8c0e2c2332ae to your computer and use it in GitHub Desktop.
Save fumiyas/9b3a927b8c0e2c2332ae to your computer and use it in GitHub Desktop.
Generate Windows NT password hash
#!/usr/bin/python
import sys
import getpass
import hashlib
import binascii
if sys.stdin.isatty():
p = getpass.getpass()
else:
p = sys.stdin.readline().rstrip("\n")
hash = hashlib.new('md4', p.encode('utf-16le')).digest()
print binascii.hexlify(hash).upper()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment