PTools::Passwd - Generate and validate Unix-style passwords
This document describes version 1.03, released October, 2004
use PTools::Passwd; Encrypt a text string: $passwd = encrypt PTools::Passwd("clearTextPassword"); print "Encrypted password: ", $passwd->toStr(), "\n"; Invoke a comparison as an object method: if ( $passwd->verify("clearTextPassword") ) { print "Yep, they match.\n"; } else { print "Nope, no match.\n"; } Invoke a comparison as a class method: if ( PTools::Passwd->verify("clearText","encryptedText") ) { print "Yep, they match.\n"; } else { print "Nope, no match.\n"; } Generate a random password: $encryptedText = $passwd->random(); # 12 bytes by default $encryptedText = $passwd->random( 64 ); # 64 bytes by request
A simple little class to generate and validate Unix-style passwords.
Chris Cobb [no dot spam at ccobb dot net]
(Adapted from "Object Oriented Perl" by Damian Conway, Chap. 4)
Copyright (c) 2004-2007 by Chris Cobb. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install PTools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PTools
CPAN shell
perl -MCPAN -e shell install PTools
For more information on module installation, please visit the detailed CPAN module installation guide.