line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Session::ID::MD5_Base32; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# $Id: MD5_Base32.pm_rev 1.3 2003/12/11 16:32:08 root Exp root $ |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5713
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
1
|
|
|
1
|
|
5
|
use Digest::MD5; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
35
|
|
7
|
1
|
|
|
1
|
|
1072
|
use MIME::Base32 qw( 09AV ); |
|
1
|
|
|
|
|
796
|
|
|
1
|
|
|
|
|
7
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
36
|
use vars qw( $VERSION ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
139
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '1.01'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub generate_id { |
14
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
15
|
0
|
|
|
|
|
|
my $md5 = new Digest::MD5(); |
16
|
0
|
|
|
|
|
|
$md5->add( $$ , time() , rand(9999) ); |
17
|
0
|
|
|
|
|
|
return MIME::Base32::encode($md5->digest()); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=pod |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
CGI::Session::ID::MD5_Base32 - CGI::Session ID driver based on Base32 encoding |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
use CGI::Session; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
$session = new CGI::Session("id:MD5_Base32", undef, { Directory => '/tmp' }; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
CGI::Session::ID::MD5_Base32 is to generate MD5 digest Base32 encoded random ids. |
38
|
|
|
|
|
|
|
The library does not require any arguments. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
There are two reasons why to use it |
41
|
|
|
|
|
|
|
- shorter string result |
42
|
|
|
|
|
|
|
- case insensibility |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
( both very usefull for user login and other similar purposes, keyboard inputs, email contained codes, etc... ) |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 COPYRIGHT |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Copyright (C) 2003 Daniel Peder. All rights reserved. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This library is free software. You can modify and distribute it under the same terms as Perl itself. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Partialy based on CGI::Session::ID::MD5 and the whole excelent CGI::Session work by |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Sherzod Ruzmetov |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Daniel Peder |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Feedbacks, suggestions and patches are welcome. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 SEE ALSO |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=over 4 |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L - Base32 encoding method ( insensitive to character cases thus most usefull for user keyboard inputs ) |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
L - Base64 encoding method |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L - Auto Incremental ID generator |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
L - CGI::Session manual |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
L - extended CGI::Session manual |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
L - practical solutions for real life problems |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=item * |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
B - "HTTP State Management Mechanism" found at ftp://ftp.isi.edu/in-notes/rfc2965.txt |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L - standard CGI library |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L - another fine alternative to CGI::Session |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=back |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=cut |