[hashcash] example v1 stamp

  • From: Adam Back <adam@xxxxxxxxxxxxxxx>
  • To: hashcash <hashcash@xxxxxxxxxxxxx>
  • Date: Wed, 28 Apr 2004 16:34:55 -0400

Well I coded a little bit, and can now create and verify v1 stamps.

Here's a real example:

1:20:040428:foo::0298b26853c8ebb3:beca0

which is broken down by : separated field:

ver = 1
stamp size = 20 bits
date = today (28/04/2004)
resource = foo
extension = empty
random = 0298b26853c8ebb3
counter = beca0

as before can be checked with:

        % echo -n 1:20:040428:foo::0298b26853c8ebb3:beca0 | sha1
        0000035566db5515582d30e899155ba237b9e82c

As you can see there are 22 leading zero bits (3 = 0011 in binary),
but the hashcash-1.0 client says there are 20 because 22 >= 20 and 20
is what it was minted as, as evidenced by the 2nd : separated field.

the random field is to avoid collisions; the counter starts at 0 and
increases.  For small numbers of bits you expect a short counter (on
average) and for larger numbers of bits you expect a larger counter.

This arrangement with separate randomness part counter field makes the
probability of collision collision independent of size in bits.

You can also see directly in the stamp btw how unlucky the generator
got.  So for a 20 bit stamp you expect 2^20 tries which is 1
mega-tries, or 100000 in hex.  You can see it took only BECA0 tries or
about BE/100 = 74% of expected time.

Adam

Other related posts: