line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Types::Digest; |
2
|
2
|
|
|
2
|
|
35282
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
55
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
102
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.1.2'; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1050
|
use Type::Library -base, -declare => qw(Md5 Sha1 Sha224 Sha256 Sha384 Sha512); |
|
2
|
|
|
|
|
39068
|
|
|
2
|
|
|
|
|
20
|
|
8
|
2
|
|
|
2
|
|
4003
|
use Types::Standard qw(Str); |
|
2
|
|
|
|
|
60428
|
|
|
2
|
|
|
|
|
22
|
|
9
|
2
|
|
|
2
|
|
2364
|
use Type::Utils; |
|
2
|
|
|
|
|
7631
|
|
|
2
|
|
|
|
|
16
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Types::Digest - digests types for Moose and Moo |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
package Foo; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use Moose; |
20
|
|
|
|
|
|
|
use Types::Digest qw/Md5 Sha256/; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has md5 => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => Md5, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has sha256 => ( |
28
|
|
|
|
|
|
|
is => 'ro', |
29
|
|
|
|
|
|
|
isa => Sha256, |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 DESCRIPTION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
This module provides common digests types for Moose, Moo, etc. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 SUBTYPES |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 Md5 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
L |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 Sha1 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
L |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 Sha224 |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
L |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 Sha256 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
L |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 Sha384 |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
L |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 Sha512 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
_declare_digest('Md5', 32); |
66
|
|
|
|
|
|
|
_declare_digest('Sha1', 40); |
67
|
|
|
|
|
|
|
_declare_digest('Sha224', 56); |
68
|
|
|
|
|
|
|
_declare_digest('Sha256', 64); |
69
|
|
|
|
|
|
|
_declare_digest('Sha384', 96); |
70
|
|
|
|
|
|
|
_declare_digest('Sha512', 128); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _declare_digest { |
73
|
12
|
|
|
12
|
|
18
|
my ($name, $len) = @_; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
declare $name, |
76
|
36
|
|
|
36
|
|
21040
|
as Str, where { /[a-f0-9]{$len}/i }, |
77
|
12
|
|
|
12
|
|
22
|
message { "Must be $len chars, and contain only [0-9a-fA-F]" }; |
|
12
|
|
|
|
|
2930
|
|
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
this module is inspired by L |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 LICENSE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Copyright (C) Avast Software. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
89
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Jan Seidl Eseidl@avast.comE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |