ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Digest-Hashcash/README
Revision: 1.4
Committed: Tue Jul 21 05:01:01 2015 UTC (8 years, 11 months ago) by root
Branch: MAIN
CVS Tags: rel-1_1, rel-1_0, HEAD
Changes since 1.3: +5 -0 lines
Log Message:
1.0

File Contents

# Content
1 NAME
2 Digest::Hashcash - generate Hashcashes (http://www.hashcash.org)
3
4 SYNOPSIS
5 use Digest::Hashcash;
6
7 DESCRIPTION
8 This module implements the hashcash hash (or digest, although it's not
9 clearly a digest). For all your information needs please visit
10 http://www.hashcash.org.
11
12 One thing to note about this module is that it requires ISO C99 support,
13 both in your compiler and your standard library. If you don't have a
14 compiler that supports ISO C, get gcc at http://gcc.gnu.org/ :)
15
16 $secs = estimate_time $size
17 Estimate the average time necessary to calculate a token of the
18 given size.
19
20 See also "estimate_size".
21
22 $size = estimate_size $time[, $min]
23 Estimate the size that can be calculated in the given time (which is
24 an upper bound). The function will not return a size less then
25 "min".
26
27 Estimating the time to be used can go wrong by as much as 50% (but
28 is usually quite accurate), and the estimation itself can take as
29 much as a second on slower (<pentium) machines, but faster machines
30 (1Ghz P3 for example) usually handle it within a hundredth of a
31 second or so.
32
33 The estimation will be done only once, so you can call this fucntion
34 as often as you like without incuring the overhead everytime.
35
36 $cipher = new Digest::Hashcash [param => value...]
37
38 size => 18
39 The number of collisions, in bits. Every bit increases the time
40 to create the token (and thus the cash) by two.
41
42 uid => ""
43 A string used to make the token more unique (e.g. the senders
44 address) and reduce token collisions. The string must only
45 contain characters valid for the trial part of the token, e.g.
46 uuencoded, base64 or e-mail-address-parts are useful here.
47
48 extrarand => 0
49 The extra bytes of randomness to add to the token in addition to
50 the standard amount. Each byte adds a little bit over 6 bit of
51 randomness to the token.
52
53 The standard amount of randomness is 8 (> 51 bits of
54 randomness).
55
56 timestamp => 0
57 The timestamp to use. A value of 0 (the default) means to use
58 the current time.
59
60 $token = $cipher->hash ($data [, param => value...])
61 Creates and returns a new token. This can take some time.
62
63 Any additional parameters are interpreted the same way as arguments
64 to "new".
65
66 $prefix = $cipher->verify ($token [, param => value...]))
67 Checks the given token and returns true if the token has the minimum
68 number of prefix bits, or false otherwise. The value returned is
69 actually the number of collisions, so to find the number of
70 collisions bits specify "collisions => 0".
71
72 Any additional parameters are interpreted the same way as arguments
73 to "new".
74
75 $resource = $cipher->resource ($token)
76 Returns the resource part, or "undef".
77
78 $tstamp = $ciper->timestamp ($token)
79 Returns the timestamp part (in the same format as perl's "time"), or
80 "undef".
81
82 SEE ALSO
83 <http://www.hashcash.org>.
84
85 SUPPORT FOR THE PERL MULTICORE SPECIFICATION
86 This module supports the perl multicore specification
87 (<http://perlmulticore.schmorp.de/>) for token generation of any length
88 and size.
89
90 BUGS
91 * There is a y2k+100 problem, as I always assume the same as Time::Local.
92 This is a problem with the hashcash specification, which specifies
93 years as 2 digits :(
94
95 AUTHOR
96 Marc Lehmann <schmorp@schmorp.de>
97 http://home.schmorp.de
98