[hashcash] Re: -or xxx -or yyy -or zzz

  • From: Adam Back <adam@xxxxxxxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Tue, 19 Oct 2004 03:34:39 -0400

I think you're trying to a generic rule to automatically create
argument sets.

Firstly you only need the -o flag (override) if you are requiring
different amounts of bits for different addresses.  If all addresses
require the same bit sizes you just list them all with multiple -r
flags eg:

hashcash -cdb20 -r 'webmaster@xxxxxxxxxxxxxx' -r '*@suspicious.org' 

etc.  (by default wild card addresses are enabled (-M), also available
as optiosn are simple string -S (no wild cards) and -E regular
expressions) (in fact with that example the 1st one is redundant as it
would be accepted by the 2nd -r anyway, but you get the idea).

However if you want different addresses to have different bit
requirements and you do this (no -o):

hashcash -cdb20 -r 'webmaster@xxxxxxxxxxxxxx' -b 15 -r '*@suspicious.org' 

then webmaster@xxxxxxxxxxxxxx would be acccepted with 15 bits under
the 2nd -r, which is presumably not what you wanted.

So to force the webmaster requires 20 bits but other addresses
(specified with wild card that also matches webmaster) require only 15
bits you would put a -o switch to say that 'webmaster@' overrides '*@':

hashcash -cdb20 -r 'webmaster@xxxxxxxxxxxxxx' -b 15 -or '*@suspicious.org' 

that means if webmaster fails, it will not consider rule for '*@'.
You will see message like this if it happens:

hashcash -cvd -b10 -or adam@xxxxxxx -b5 -or '*@foo.com' 
1:5:041019:adam@xxxxxxx::/7w1dJqcCfMYeqkp:000000000t
checking against resource: adam@xxxxxxx
no match: token has insufficient bits
checking against resource: *@foo.com
no match: overridden resource
rejected: no valid tokens found
check: failed


Next question will -or as the only resource work?  Well strictly
speaking the -o applies to the preceding rule.  However if it is the
first or only rule the -o is effectively ignored, and so for the first
rule -or is equivalent to -r.

But I don't think I changed anything related to -o processing in 1.13.
I expect this behavior to have been there for some time.

Adam

On Tue, Oct 19, 2004 at 02:33:01AM -0400, Atom 'Smasher' wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> when checking stamps, should i expect everything to work fine when the 
> first (or only) resource to be checked is specified with "-or"?
> 
> this seems to work in 1.13, but IIRC it didn't work in an earlier version. 
> i'm not sure if this is a feature or a bug, but i'd like to request that 
> this behavior be documented and remain intact. if i can count on this, it 
> will make it *MUCH* easier for me to publish a dot-qmail recipe for 
> accepting valid stamps... if anyone's interested...

Other related posts: