Authen...NTHash(3pm)

πŸ’– Authen::Passphrase::NTHash β€” the manual page, but make it make sense πŸ’–

okay bestie, so this is Authen::Passphrase::NTHash(3pm), straight out of the User Contributed Perl Documentation corner of the Perl universe. It's the whole NT-Hash passphrase situation, explained with love. let's go πŸ¦‹


✨ NAME ✨

Authen::Passphrase::NTHash β€” passphrases using the NT-Hash algorithm. that's it, that's the name, she's iconic and she's exactly what she says on the tin πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the vibe, code and all β€” literally copy-paste energy:

use Authen::Passphrase::NTHash;

$ppr = Authen::Passphrase::NTHash->new(
        hash_hex => "7f8fe03093cc84b267b109625f6bbf4b");

$ppr = Authen::Passphrase::NTHash->new(
        passphrase => "passphrase");

$ppr = Authen::Passphrase::NTHash->from_crypt(
        '$3$$7f8fe03093cc84b267b109625f6bbf4b');

$ppr = Authen::Passphrase::NTHash->from_rfc2307(
        '{MSNT}7f8fe03093cc84b267b109625f6bbf4b');

$hash = $ppr->hash;
$hash_hex = $ppr->hash_hex;

if($ppr->match($passphrase)) { ...

$passwd = $ppr->as_crypt;
$userPassword = $ppr->as_rfc2307;

🌸 DESCRIPTION 🌸

so, an object of this class is basically a little vessel that holds a passphrase hashed with the NT-Hash function. that's the whole point of her existence 🫢

⚠️ important: she is a subclass of Authen::Passphrase, and this doc assumes you already know your way around that class's documentation. if you don't, go read that first, no cap.

now the actual tea: the NT-Hash scheme rides on the MD4 digest algorithm. here's how it works β€” up to 128 characters of passphrase get represented in Unicode, and anything past the 128th character is ignored (yes, straight up thrown away 😭), and then the whole thing is hashed using MD4. and the salt? there is no salt. none. zero. not a single grain. No salt is used. periodt.

Warning: MD4 is a weak hash algorithm by current standards, and the lack of salt is a design flaw in this scheme. Use this for compatibility only, not by choice. 🚨 like, fr fr, this is a compatibility moment, not a make-good-life-choices moment.

πŸ’« CONSTRUCTORS πŸ’«

Authen::Passphrase::NTHash->new(ATTR => VALUE, ...)

makes you a shiny new passphrase recogniser object using the NT-Hash algorithm ✨ you can pass it these attributes:

  • hash β€” the hash, as a string of 16 bytes.
  • hash_hex β€” the hash, as a string of 32 hexadecimal digits.
  • passphrase β€” a passphrase that will be accepted.
🚨 you must give either the hash or the passphrase. pick one, bestie, them's the rules.

Authen::Passphrase::NTHash->from_crypt(PASSWD)

builds you a new NT-Hash passphrase recogniser object out of a crypt string. two forms are accepted, so listen up πŸ‘‘

  1. first form: the crypt string has to be "$3$$" β€” and yes, note that extra "$", she's not a typo, she's a feature β€” followed by the hash in lowercase hexadecimal.
  2. second form: the crypt string has to be "$NT$" followed by the hash in lowercase hexadecimal.

Authen::Passphrase::NTHash->from_rfc2307(USERPASSWORD)

same energy but for an RFC 2307 string. two forms are accepted again:

  1. first form: the string has to be "{MSNT}" followed by the hash in hexadecimal β€” and case is ignored here, so do you πŸ’…
  2. second form: the string has to be "{CRYPT}" (case insensitive, queen) followed by an acceptable crypt string.

πŸ‘‘ METHODS πŸ‘‘

$ppr->hash

hands you back the hash value, as a string of 16 bytes πŸ“

$ppr->hash_hex

hands you back the hash value, as a string of 32 hexadecimal digits ⭐

$ppr->match(PASSPHRASE)

$ppr->as_crypt

$ppr->as_rfc2307

these three? they're all part of the standard Authen::Passphrase interface. nothing extra, nothing invented, just the classic trio doing their thing πŸ’œ


🌈 SEE ALSO 🌈

  • Authen::Passphrase
  • Digest::MD4

go read them, they're the supporting cast and they ate πŸ’–


🧚 AUTHOR 🧚

Andrew Main (Zefram) <zefram@fysh.org> β€” absolute legend, respect on the name πŸ™Œ


Copyright (C) 2006, 2007, 2009, 2010, 2012 Andrew Main (Zefram) <zefram@fysh.org>


πŸ’œ LICENSE πŸ’œ

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. slay, and legally so 🫢


and that's the whole page bestie!! πŸ’… this was served up with perl v5.40.1, dated 2026-05-06, and yes the title really is Authen...NTHash(3pm) β€” those dots are just the manpage being mysterious and cute. go forth and be compatibility-only about it πŸ’–βœ¨

πŸ“¦ where this page comes from