ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Digest-Hashcash/Hashcash.pm
(Generate patch)

Comparing Digest-Hashcash/Hashcash.pm (file contents):
Revision 1.2 by root, Sun Sep 7 00:58:23 2003 UTC vs.
Revision 1.4 by root, Sun Jun 27 14:03:28 2004 UTC

70 my ($time, $min) = @_; 70 my ($time, $min) = @_;
71 $time = (log $time * $rounds) / log 2; 71 $time = (log $time * $rounds) / log 2;
72 $time < $min ? $min : int $time; 72 $time < $min ? $min : int $time;
73} 73}
74 74
75=item $cipher = new [param => value...] 75=item $cipher = new Digest::Hashcash [param => value...]
76 76
77=over 4 77=over 4
78 78
79=item size => 18 79=item size => 18
80 80
101The timestamp to use. A value of 0 (the default) means to use the current 101The timestamp to use. A value of 0 (the default) means to use the current
102time. 102time.
103 103
104=back 104=back
105 105
106=item $token = $cipher->hash($data [, param => value...]) 106=item $token = $cipher->hash ($data [, param => value...])
107 107
108Creates and returns a new token. This can take some time. 108Creates and returns a new token. This can take some time.
109 109
110Any additional parameters are interpreted the same way as arguments to 110Any additional parameters are interpreted the same way as arguments to
111C<new>. 111C<new>.
112 112
113=item $prefix = $cipher->verify($token [, param => value...])) 113=item $prefix = $cipher->verify ($token [, param => value...]))
114 114
115Checks the given token and returns true if the token has the minimum 115Checks the given token and returns true if the token has the minimum
116number of prefix bits, or false otherwise. The value returned is actually 116number of prefix bits, or false otherwise. The value returned is actually
117the number of collisions, so to find the number of collisions bits specify 117the number of collisions, so to find the number of collisions bits specify
118C<< collisions => 0 >>. 118C<< collisions => 0 >>.
119 119
120Any additional parameters are interpreted the same way as arguments to 120Any additional parameters are interpreted the same way as arguments to
121C<new>. 121C<new>.
122 122
123=item $resource = $cipher->resource($token) 123=item $resource = $cipher->resource ($token)
124 124
125Returns the resource part, or C<undef>. 125Returns the resource part, or C<undef>.
126 126
127=item $tstamp = $ciper->timestamp($token) 127=item $tstamp = $ciper->timestamp ($token)
128 128
129Returns the timestamp part (in the same format as perl's C<time>), or 129Returns the timestamp part (in the same format as perl's C<time>), or
130C<undef>. 130C<undef>.
131 131
132=back 132=back
190 190
191=head1 BUGS 191=head1 BUGS
192 192
193 * There is a y2k+100 problem, as I always assume the same as Time::Local. 193 * There is a y2k+100 problem, as I always assume the same as Time::Local.
194 This is a problem with the hashcash specification, which specifies 194 This is a problem with the hashcash specification, which specifies
195 yeras as 2 digits :( 195 years as 2 digits :(
196 196
197=head1 AUTHOR 197=head1 AUTHOR
198 198
199 Marc Lehmann <pcg@goof.com> 199 Marc Lehmann <pcg@goof.com>
200 http://home.schmorp.de 200 http://home.schmorp.de

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines