Creating standalone passwords in /etc/passwd format

Daniel Marsh daniel at stiw.org
Wed Aug 17 00:52:57 GMT 2005


On Tue, 16 Aug 2005 18:07:06 +0800, Gareth Bailey <gjbailey at gmail.com>  
wrote:

> I have had a look at crypt (enigma), but it doesn't appear to use the
> same algorithm? I need the same as that used in passwd!
>
> Thanks

Try making a PERL script with the following lines...

$UserDetails{EncryptedPassword} = crypt($UserDetails{TextPassword}, join  
'', ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[rand 64, rand 64]); # this  
creates an encrypted password the same format as the MD5 in /etc/passwd

my $PassMD5 = crypt($Login->{Password}, $EncryptedPassword); # this  
creates the same MD5 string, used for verification of entering passwords  
encrypted with the above method.



More information about the freebsd-questions mailing list