[hashcash] Re: new format tweak coming...

  • From: "Eric S. Johansson" <esj@xxxxxxxxxx>
  • To: hashcash@xxxxxxxxxxxxx
  • Date: Sat, 13 Mar 2004 22:54:27 -0500

Justin Mason wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Hubert Chan writes:
> 
>>>>>>>"Justin" == Justin Mason <jm@xxxxxxxxxx> writes:
>>
>>[...]
>>
>>Adam> Yes I had come to think the same thing ... re "'" or '"' as the
>>Adam> two choices, and this is the "perl" thing, plus "\"'" and '"'\'
>>
>>Ben> This is icky - whatever format you use should, IMO, be regex
>>Ben> friendly, and trivial to parse. This is neither. I'd vote for URL
>>Ben> encoding.
>>
>>Justin> +1 on this idea -- me too.  URL encoding is much easier to parse
>>Justin> than backslashing.
>>
>>My personal opinion is that since the stamps are primarily meant for
>>computer consumption, to just use a single type of quotes, and
>>backslash-escape the quotes, and backslash.  It takes a bit less
>>processing, and is still fairly readable if anyone wants to look at the
>>stamp.
>>
>>I don't see backslashing any harder to parse than URL encoding -- just
>>scan through the string from left to right, and every time you see a
>>backslash, drop it and take the next character as a literal.
>>
>>I also don't see backslashing, or having two types of quotes, as being
>>regex unfriendly.
> 
> 
> Oh good, you'd be happy to provide a regex that'll do the above
> left-to-right scan to cope with
> 
>   foo:"bar \\\\\\\\\\\\\\\":baz":blargh
> 
> then.  as far as I know it can be done with perl re's, but
> I don't know the recipe off-hand ;)

"(\w\s\\*)" should be a good starting point. and to be totally correct 
the expression should be:

foo="bar \\\\\\\\\\\\\\\":baz="blargh" because every attribute is of a 
form (\w)="(.*): including the last entry because that's the : 
introducing the random field.

I think the question we should be asking is "what's the interface".  To 
append or generate over a list of these and to normalize the data coming 
into or out of the interface is really what we should be concerned with 
at this point.  URL encoding or \ quoting is just picking over the 
bones.  Personally, I think that picking a format and then not supplying 
any interfaces parsing it is just plain cruel.  we, as a profession 
waste away too much time reinventing wheels.

so, to me a simple interface would be best.  But it is far too late for 
me to think clearly on how to do so.  But I just wanted to raise the 
idea of looking at hashcash as a library with a command line wrapper 
instead of a command line program used as a library.  (hashcashd??)

more tomorrow.

---eric


Other related posts: