line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Crypt::Random::Source; # git description: v0.11-3-gecbdd17 |
2
|
|
|
|
|
|
|
# ABSTRACT: Get weak or strong random data from pluggable sources |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
13088
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
7
|
1
|
|
|
1
|
|
16
|
use 5.008; |
|
1
|
|
|
|
|
2
|
|
8
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
37
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
|
|
6
|
use Sub::Exporter -setup => { |
11
|
|
|
|
|
|
|
exports => [qw( |
12
|
|
|
|
|
|
|
get get_weak get_strong |
13
|
|
|
|
|
|
|
factory |
14
|
|
|
|
|
|
|
)], |
15
|
|
|
|
|
|
|
groups => { default => [qw(get get_weak get_strong)] }, |
16
|
1
|
|
|
1
|
|
485
|
}; |
|
1
|
|
|
|
|
8630
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
625
|
use Crypt::Random::Source::Factory; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
226
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our ( $factory, $weak, $strong, $any ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# silence some stupid destructor warnings |
23
|
1
|
|
|
1
|
|
1
|
END { undef $weak; undef $strong; undef $any; undef $factory } |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
33
|
1
|
0
|
10
|
sub factory () { $factory ||= Crypt::Random::Source::Factory->new } |
26
|
1
|
|
33
|
1
|
|
5
|
sub _weak () { $weak ||= factory->get_weak } |
27
|
0
|
|
0
|
0
|
|
0
|
sub _strong () { $strong ||= factory->get_strong } |
28
|
0
|
|
0
|
0
|
|
0
|
sub _any () { $any ||= factory->get } |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
1
|
0
|
sub get ($;@) { _any->get(@_) } |
31
|
1
|
|
|
1
|
1
|
406
|
sub get_weak ($;@) { _weak->get(@_) } |
32
|
0
|
|
|
0
|
1
|
|
sub get_strong ($;@) { _strong->get(@_) } |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# silence some stupid destructor warnings |
35
|
1
|
|
|
1
|
|
101
|
END { undef $weak; undef $strong; undef $any; undef $factory } |
|
1
|
|
|
|
|
286
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=pod |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=encoding UTF-8 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 NAME |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Crypt::Random::Source - Get weak or strong random data from pluggable sources |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 VERSION |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
version 0.12 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 SYNOPSIS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
use Crypt::Random::Source qw(get_strong); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# get 10 cryptographically strong random bytes from an available source |
56
|
|
|
|
|
|
|
my $bytes = get_strong(10); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This module provides implementations for a number of byte oriented sources of |
61
|
|
|
|
|
|
|
random data. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
See L for a more powerful way to locate |
64
|
|
|
|
|
|
|
sources, and the various sources for specific implementations. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 EXPORTS |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over 4 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item get |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item get_weak |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item get_strong |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
These functions delegate to a source chosen by an instance of |
77
|
|
|
|
|
|
|
L, calling get |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SEE ALSO |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
L, L |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 SUPPORT |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Bugs may be submitted through L |
88
|
|
|
|
|
|
|
(or L). |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 AUTHOR |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 CONTRIBUTORS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=for stopwords Karen Etheridge Florian Ragwitz Graham Knop David Pottage Max Kanat-Alexander |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=over 4 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Karen Etheridge |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Florian Ragwitz |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Graham Knop |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
David Pottage |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Max Kanat-Alexander |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Yuval Kogman. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
127
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__END__ |