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