[hashcash] Re: colon within resource

is there a standard way to handle a colon (:) within a stamps resource?

I don't believe there is - the intention is to leave that to the extension definition. That way, simple extensions don't have to parse a potentially complex encoding, unless they need to. However, I can offer suggestions.


The hashcash token as a whole is limited to the alphabet allowed in electronic message headers. The alphabet used by each field is further reduced by the colon separator, and the extension field's alphabet is also reduced by the use of a comma to separate different extensions. The name of an extension also cannot contain an equals sign, because that separates it from the extension body.

With that in mind, there are several possibilities. If all you need is a separator that won't be confused with the ones used elsewhere, either the semicolon or pipe symbol should suffice. Both of these are outside the Base64 alphabet, but within that allowed in the extension field.

If your needs are more general, however, I suggest URL encoding for data which is mostly ASCII text, and Base64 otherwise. Note that the Base64 alphabet contains the equals sign, so it can only be used in the extension body, not the name, but this should not be restrictive in practice. Either URL or Base64 encoding can be used with semicolon and/or pipe-symbol separators without confusion.

--------------------------------------------------------------
from:     Jonathan "Chromatix" Morton
mail:     chromi@xxxxxxxxxxxxxxxxxxxxx
website:  http://www.chromatix.uklinux.net/
tagline:  The key to knowledge is not to rely on people to teach you it.


Other related posts: