NAME
Text::Password::SHA - generate and verify Password with SHA
SYNOPSIS
my $pwd = Text::Password::SHA->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::SHA is the last part of Text::Password::AutoMigration.
Constructor and initialization
new()
No arguments are required. But you can set some arguments.
- default( Int )
-
You can set other length to 'default' like below:
$pwd = Text::Password::AutoMiglation->new( default => 8 );
- readablity( Bool )
-
It must be a boolean, default is 1.
less readable characters(0Oo1Il|!2Zz5sS$6b9qCcKkUuVvWwXx.,:;~-^'"`) are forbidden while $self->readability is 1.
You can let passwords to be more secure with setting readablity =< 0.
Then you can generate stronger passwords with generate().
$pwd = Text::Password::AutoMiglation->new( readability => 0 );
# or $pwd->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 10 || $self->default().
encrypt( Str )
returns hash with unix_sha512_crypt().
salt will be made automatically.
generate( Int )
generates pair of new password and its hash.
less readable characters(0Oo1Il|!2Zz5sS$6b9qCcKkUuVvWwXx.,:;~-^'"`) are forbidden unless $self->readability is 0.
the length defaults to 10 || $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>