… | |
… | |
31 | second or so. |
31 | second or so. |
32 | |
32 | |
33 | The estimation will be done only once, so you can call this fucntion |
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. |
34 | as often as you like without incuring the overhead everytime. |
35 | |
35 | |
36 | $cipher = new [param => value...] |
36 | $cipher = new Digest::Hashcash [param => value...] |
37 | |
37 | |
38 | size => 18 |
38 | size => 18 |
39 | The number of collisions, in bits. Every bit increases the time |
39 | The number of collisions, in bits. Every bit increases the time |
40 | to create the token (and thus the cash) by two. |
40 | to create the token (and thus the cash) by two. |
41 | |
41 | |
… | |
… | |
55 | |
55 | |
56 | timestamp => 0 |
56 | timestamp => 0 |
57 | The timestamp to use. A value of 0 (the default) means to use |
57 | The timestamp to use. A value of 0 (the default) means to use |
58 | the current time. |
58 | the current time. |
59 | |
59 | |
60 | $token = $cipher->hash($data [, param => value...]) |
60 | $token = $cipher->hash ($data [, param => value...]) |
61 | Creates and returns a new token. This can take some time. |
61 | Creates and returns a new token. This can take some time. |
62 | |
62 | |
63 | Any additional parameters are interpreted the same way as arguments |
63 | Any additional parameters are interpreted the same way as arguments |
64 | to "new". |
64 | to "new". |
65 | |
65 | |
66 | $prefix = $cipher->verify($token [, param => value...])) |
66 | $prefix = $cipher->verify ($token [, param => value...])) |
67 | Checks the given token and returns true if the token has the minimum |
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 |
68 | number of prefix bits, or false otherwise. The value returned is |
69 | actually the number of collisions, so to find the number of |
69 | actually the number of collisions, so to find the number of |
70 | collisions bits specify "collisions => 0". |
70 | collisions bits specify "collisions => 0". |
71 | |
71 | |
72 | Any additional parameters are interpreted the same way as arguments |
72 | Any additional parameters are interpreted the same way as arguments |
73 | to "new". |
73 | to "new". |
74 | |
74 | |
75 | $resource = $cipher->resource($token) |
75 | $resource = $cipher->resource ($token) |
76 | Returns the resource part, or "undef". |
76 | Returns the resource part, or "undef". |
77 | |
77 | |
78 | $tstamp = $ciper->timestamp($token) |
78 | $tstamp = $ciper->timestamp ($token) |
79 | Returns the timestamp part (in the same format as perl's "time"), or |
79 | Returns the timestamp part (in the same format as perl's "time"), or |
80 | "undef". |
80 | "undef". |
81 | |
81 | |
82 | SEE ALSO |
82 | SEE ALSO |
83 | <http://www.hashcash.org>. |
83 | <http://www.hashcash.org>. |
84 | |
84 | |
85 | BUGS |
85 | BUGS |
86 | * There is a y2k+100 problem, as I always assume the same as Time::Local. |
86 | * There is a y2k+100 problem, as I always assume the same as Time::Local. |
87 | This is a problem with the hashcash specification, which specifies |
87 | This is a problem with the hashcash specification, which specifies |
88 | yeras as 2 digits :( |
88 | years as 2 digits :( |
89 | |
89 | |
90 | AUTHOR |
90 | AUTHOR |
91 | Marc Lehmann <pcg@goof.com> |
91 | Marc Lehmann <schmorp@schmorp.de> |
92 | http://home.schmorp.de |
92 | http://home.schmorp.de |
93 | |
93 | |