line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
2
|
|
|
|
|
|
|
use Moose; |
3
|
1
|
|
|
1
|
|
52746
|
|
|
1
|
|
|
|
|
354111
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: An Argon2 implemenation of Password::OWASP |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
with 'Password::OWASP::AbstractBase'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Authen::Passphrase::Argon2; |
9
|
1
|
|
|
1
|
|
6032
|
|
|
1
|
|
|
|
|
12588
|
|
|
1
|
|
|
|
|
52
|
|
10
|
|
|
|
|
|
|
|
11
|
15
|
|
|
15
|
0
|
118
|
__PACKAGE__->meta->make_immutable; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=pod |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=encoding UTF-8 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Password::OWASP::Argon2 - An Argon2 implemenation of Password::OWASP |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 VERSION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
version 0.005 |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 SYNOPSIS |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
package MyApp::Authentication; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
use Password::OWASP::Argon2; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $user = get_from_db(); |
33
|
|
|
|
|
|
|
my $from_web = "Super secret password"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $owasp = Password::OWASP::Argon2->new( |
36
|
|
|
|
|
|
|
# optional |
37
|
|
|
|
|
|
|
hashing => 'sha512', |
38
|
|
|
|
|
|
|
update_method => sub { |
39
|
|
|
|
|
|
|
my $password = shift; |
40
|
|
|
|
|
|
|
$user->update_password($password); |
41
|
|
|
|
|
|
|
return; |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
if (!$owasp->check_password($from_web)) { |
46
|
|
|
|
|
|
|
die "You cannot login"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Implements Argon2 password checking. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 METHODS |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 crypt_password |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Encrypt the password and return it as an RFC2307 formatted string. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 check_password |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Check if the password is the same as what was stored. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 SEE ALSO |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=over |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * L<Password::OWASP::AbstractBase> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * L<Authen::Passphrase::BlowfishCrypt> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=back |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Wesley Schwengle <waterkip@cpan.org> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Wesley Schwengle. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software, licensed under: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The (three-clause) BSD License |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |