line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Crypt::Salt; |
3
|
2
|
|
|
2
|
|
70497
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
97
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
BEGIN { |
6
|
2
|
|
|
2
|
|
11
|
use Exporter (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
43
|
|
7
|
2
|
|
|
2
|
|
10
|
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
307
|
|
8
|
2
|
|
|
2
|
|
6
|
$VERSION = 0.01; |
9
|
2
|
|
|
|
|
34
|
@ISA = qw (Exporter); |
10
|
|
|
|
|
|
|
#Give a hoot don't pollute, do not export more than needed by default |
11
|
2
|
|
|
|
|
12
|
@EXPORT = qw (salt); |
12
|
2
|
|
|
|
|
6
|
@EXPORT_OK = qw (salt); |
13
|
2
|
|
|
|
|
544
|
%EXPORT_TAGS = (); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Crypt::Salt - Module for generating a salt to be fed into crypt. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Crypt::Salt; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
print crypt( "secret", salt() ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The single exported subroutine in this module is for generating a salt suitable for being fed to crypt() and other similar functions. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 BUGS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Please let the author know if any are caught |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 AUTHOR |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Jonathan Steinert |
39
|
|
|
|
|
|
|
hachi@cpan.org |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 COPYRIGHT |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This program is free software; you can redistribute |
44
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
The full text of the license can be found in the |
47
|
|
|
|
|
|
|
LICENSE file included with this module. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SEE ALSO |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
perl(1). |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
############################################# main pod documentation end ## |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
################################################ subroutine header begin ## |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 salt |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Argument : The first argument as passed will be used in numeric context as a count of how many characters you want returned in the salt, the default is 2. All other arguments are ignored. |
64
|
|
|
|
|
|
|
Returns : A string of random characters suitable for use when being passed to the crypt() function |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
################################################## subroutine header end ## |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub salt |
72
|
|
|
|
|
|
|
{ |
73
|
1000
|
|
|
1000
|
1
|
592307
|
my $length = 2; |
74
|
1000
|
100
|
|
|
|
3621
|
$length = $_[0] if exists $_[0]; |
75
|
|
|
|
|
|
|
|
76
|
1000
|
|
|
|
|
2815
|
return join "", ('.', '/', 0..9, 'A'..'Z', 'a'..'z')[map {rand 64} (1..$length)]; |
|
3691
|
|
|
|
|
16161
|
|
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |