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