08-11-2023, 06:35 PM
welcome to the hell of character encodings
your hexeditor opened your file using utf-8 resulting in your shown hex BUT take a look at this, NTLM uses UTF16le for characterencoding and here we go
b'd65e9927549a762507bae550ba54969a'
b'e3fcd123f5bdadf2a0e61472fd13869c'
b'594fd6650f079efc9b8bfb0a1627ba70'
b'5e486282398373e0b4bedf01db16b795'
last line is the desired hash but but you see the needed conversation to get there?
your hexeditor opened your file using utf-8 resulting in your shown hex BUT take a look at this, NTLM uses UTF16le for characterencoding and here we go
Code:
val = 'PásztorZs201'
hash = hashlib.new('md4', val.encode('utf-8')).digest()
hash = binascii.hexlify(hash)
print(f"{hash}")
hash = hashlib.new('md4', val.encode('utf-16le')).digest()
hash = binascii.hexlify(hash)
print(f"{hash}")
hash = hashlib.new('md4', val.encode('iso-8859-15')).digest()
hash = binascii.hexlify(hash)
print(f"{hash}")
hash = hashlib.new('md4', val.encode('UTF-8').decode('iso-8859-15').encode('utf-16le')).digest()
hash = binascii.hexlify(hash)
print(f"{hash}")
b'd65e9927549a762507bae550ba54969a'
b'e3fcd123f5bdadf2a0e61472fd13869c'
b'594fd6650f079efc9b8bfb0a1627ba70'
b'5e486282398373e0b4bedf01db16b795'
last line is the desired hash but but you see the needed conversation to get there?