line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::PBKDF2::Hash; |
2
|
|
|
|
|
|
|
# ABSTRACT: Abstract role for PBKDF2 hashing algorithms. |
3
|
|
|
|
|
|
|
our $VERSION = '0.160410'; # VERSION |
4
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY |
5
|
6
|
|
|
6
|
|
2592
|
use Moo::Role 2; |
|
6
|
|
|
|
|
176
|
|
|
6
|
|
|
|
|
36
|
|
6
|
6
|
|
|
6
|
|
1436
|
use strictures 2; |
|
6
|
|
|
|
|
30
|
|
|
6
|
|
|
|
|
197
|
|
7
|
6
|
|
|
6
|
|
888
|
use namespace::autoclean; |
|
6
|
|
|
|
|
7
|
|
|
6
|
|
|
|
|
27
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
requires 'hash_len'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires 'generate'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
requires 'to_algo_string'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
requires 'from_algo_string'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__END__ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=pod |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=encoding UTF-8 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Crypt::PBKDF2::Hash - Abstract role for PBKDF2 hashing algorithms. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
version 0.160410 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 hash_len() |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Returns the length (in bytes) of the hashes this algorithm generates. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 generate($data, $key) |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Generate strong pseudorandom bits based on the C<$data> and C<$key> |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 to_algo_string() |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Return a string representing any optional arguments this object was created |
46
|
|
|
|
|
|
|
with, for use by L<Crypt::PBKDF2>'s C<generate> and C<encode_string> |
47
|
|
|
|
|
|
|
methods. May return undef if no arguments are required, in which case none |
48
|
|
|
|
|
|
|
will be serialized and C<from_algo_string> won't be called on reading the |
49
|
|
|
|
|
|
|
hash. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 from_algo_string($str) |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Given a string as produced by C<from_algo_string>, return an instance of |
54
|
|
|
|
|
|
|
this class with options corresponding to those in C<$str>. If no options are |
55
|
|
|
|
|
|
|
expected, it's permissible for this method to throw an exception. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Andrew Rodland <arodland@cpan.org> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Andrew Rodland. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
66
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |