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

Text::Password::MD5 - generate and verify Password with unix_md5_crypt()

SYNOPSIS

 my $pwd = Text::Password::MD5->new();
 my( $raw, $hash ) = $pwd->generate();          # list context is required
 my $input = $req->body_parameters->{passwd};
my $data = $pwd->encrypt($input);    # you don't have to care about salt

 my $flag = $pwd->verify( $input, $data );

DESCRIPTION

Text::Password::MD5 is the part of Text::Password::AutoMigration.

DON'T USE directly.

Constructor and initialization

new()

No arguments are required. But you can set some parameters.

default

You can set default length with param 'default' like below:

$pwd = Text::Password::AutoMiglation->new( default => 12 );

readablity

Or you can set default strength for password with param 'readablity'.

It must be a boolean, default is 1.

If it was set as 0, you can generate stronger passwords with generate().

$pwd = Text::Password::AutoMiglation->new( readability => 0 );

Methods and Subroutines

verify( $raw, $hash )

returns true if the verification succeeds.

nonce( Int )

generates the random strings with enough strength.

the length defaults to 8 || $self->default().

encrypt( Str )

returns hash with unix_md5_crypt().

salt will be made automatically.

generate( Int )

generates pair of new password and its hash.

less readable characters (0Oo1Il|!2Zz5sS$6b9qCcKkUuVvWwXx.,:;~-^'"`) are forbiddenunless $self->readability is 0.

the length defaults to 8 || $self->default().

LICENSE

Copyright (C) Yuki Yoshida(worthmine).

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Yuki Yoshida <worthmine@users.noreply.github.com>