Authen...SPurdy(3pm)
π NAME π
Authen::Passphrase::VMSPurdy β the passphrase class that does the VMS Purdy polynomial system, bestie. Yes, that's the same page as Authen...SPurdy(3pm) from the User Contributed Perl Documentation, we're just making it cute. π
β¨ SYNOPSIS β¨
use Authen::Passphrase::VMSPurdy;
$ppr = Authen::Passphrase::VMSPurdy->new(
username => "jrandom", salt => 25362,
hash_hex => "832a0c270179584a");
$ppr = Authen::Passphrase::VMSPurdy->new(
username => "jrandom", salt_random => 1,
passphrase => "passphrase");
$ppr = Authen::Passphrase::VMSPurdy->from_crypt(
'$VMS3$1263832A0C270179584AJRANDOM');
$ppr = Authen::Passphrase::VMSPurdy->from_rfc2307(
'{CRYPT}$VMS3$1263832A0C270179584AJRANDOM');
$algorithm = $ppr->algorithm;
$username = $ppr->username;
$salt = $ppr->salt;
$hash = $ppr->hash;
$hash_hex = $ppr->hash_hex;
if($ppr->match($passphrase)) { ...
$passwd = $ppr->as_crypt;
$userPassword = $ppr->as_rfc2307;
πΈ DESCRIPTION πΈ
okay so. An object of this class wraps up a passphrase hashed with one of the Purdy polynomial hash functions that VMS uses. It's a subclass of Authen::Passphrase, and this doc just assumes you already know that class's docs, fr fr. Go read those first, iykyk. π
The core of the Purdy polynomial hashing algorithm takes one 64-bit number and transforms it into another 64-bit number. It was developed by George B. Purdy, and it's described in a paper called "A High Security Log-in Procedure", which lives at:
<http://portal.acm.org/citation.cfm?id=361089&dl=GUIDE&coll=ACM&CFID=15151515&CFTOKEN=6184618>
For actual practical use in passphrase hashing, tho, you can't just have the polynomial β it has to be augmented by a procedure that turns a variable-length passphrase into that initial 64-bit number that gets hashed. In VMS this pre-hashing phase also mixes in the username of the account whose access is being controlled, specifically so that two identical passphrases don't produce identical hashes. It's giving salting, basically. π§ And there's another salt parameter too, a 16-bit integer, and this one is literally just called "salt".
There are three variants of the pre-hashing algorithm:
- "PURDY" β the original, used during field testing of VMS 2.0. It truncates or space-pads the username to a fixed length.
- "PURDY_V" β used from VMS 2.0 up to (but not including) VMS 5.4. It properly handles the variable-length nature of the username. π
- "PURDY_S" β used from VMS 5.4 onwards. It does some extra bit rotations to avoid aliasing problems when pre-hashing long strings.
All three versions are supported by this module. We love options. π«Ά
VMS heavily restricts what usernames and passphrases can even contain. They may only contain alphanumerics, "$", and "_". Case is insignificant. Usernames must be between 1 and 31 characters long, and passphrases must be between 1 and 32 characters long. This module enforces all of those rules. An invalid passphrase is never accepted as matching β no cap, it just won't. π«
π CONSTRUCTORS π
Authen::Passphrase::VMSPurdy->new(ATTR => VALUE, ...)
Generates a shiny new passphrase recogniser object using the VMS Purdy polynomial algorithm family. You can pass it these attributes:
algorithmβ a string saying which variant of the algorithm we're using. Valid values are"PURDY"(the original),"PURDY_V"(modified to use the full length of the username), and"PURDY_S"(extra rotations to avoid aliasing when processing long strings). Default is"PURDY_S". β¨usernameβ a string used as theusernamesalt parameter. It's limited to VMS username syntax.saltβ the salt, as an integer in the range[0, 65536).salt_hexβ the salt, as a string of four hexadecimal digits. The first two digits give the least-significant byte and the last two give the most-significant byte, with most-significant nybble first within each byte. π§salt_randomβ causes salt to be generated randomly. Whatever value you give this attribute is just ignored, king. πhashβ the hash, as a string of eight bytes.hash_hexβ the hash, as a string of 16 hexadecimal digits.passphraseβ a passphrase that will be accepted. It's limited to VMS passphrase syntax.
bestie listen: theusernameandsaltmust be given, and you also need either thehashor thepassphrase. No skipping. π
Authen::Passphrase::VMSPurdy->from_crypt(PASSWD)
Generates a new passphrase recogniser object using the VMS Purdy polynomial algorithm family, from a crypt string. π
The string must consist of an algorithm identifier, then the salt in hexadecimal, then the hash in hexadecimal, then the username.
The salt must be given as four hexadecimal digits β the first two give the least-significant byte and the last two give the most-significant byte, with most-significant nybble first within each byte.
The algorithm identifier must be:
"$VMS1$"for"PURDY""$VMS2$"for"PURDY_V""$VMS3$"for"PURDY_S"
And the whole crypt string must be uppercase. Uppercase only, lowercase is not invited to this party. π
Authen::Passphrase::VMSPurdy->from_rfc2307(USERPASSWORD)
Generates a new passphrase recogniser object using the VMS Purdy polynomial algorithm family, from an RFC 2307 string. The string must consist of "{CRYPT}" (case insensitive, so she's flexible π) followed by an acceptable crypt string.
π METHODS π
$ppr->algorithmβ returns the algorithm variant identifier string. It may be"PURDY"(the original),"PURDY_V"(modified to use full length of the username), and"PURDY_S"(extra rotations to avoid aliasing when processing long strings). π$ppr->usernameβ returns the username string. All alphabetic characters in it are uppercase, because that's the canonical form, periodt.$ppr->saltβ returns the salt, as an integer.$ppr->salt_hexβ returns the salt, as a string of four hexadecimal digits. The first two digits give the least-significant byte and the last two give the most-significant byte, with most-significant nybble first within each byte. Same little byte-order dance as always. π©°$ppr->hashβ returns the hash value, as a string of eight bytes.$ppr->hash_hexβ returns the hash value, as a string of 16 uppercase hexadecimal digits. π₯$ppr->match(PASSPHRASE)$ppr->as_crypt$ppr->as_rfc2307
That last little trio? Those methods are part of the standard Authen::Passphrase interface. Nothing extra, just the classics. π
π¦ SEE ALSO π¦
Authen::DecHpwdAuthen::Passphrase
π AUTHOR π
Andrew Main (Zefram) <zefram@fysh.org>
π COPYRIGHT π
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.
okay that's the whole page, we ate and left no crumbs πβ¨ this was perl v5.40.1, dated 2026-05-06, and the page is Authen...SPurdy(3pm) β mwah, go hash something responsibly π
π
π¦ where this page comes from
- ubuntu stonking: libauthen-passphrase-perl 0.009-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms