The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

PTools::Passwd - Generate and validate Unix-style passwords

VERSION

This document describes version 1.03, released October, 2004

SYNOPSIS

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

DESCRIPTION

A simple little class to generate and validate Unix-style passwords.

AUTHOR

Chris Cobb, <nospamplease@ccobb.net>

(Adapted from "Object Oriented Perl" by Damian Conway, Chap. 4)

COPYRIGHT

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.