[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Canonical form for signing S-expressions


>>>>> "Ben" == Ben Laurie <ben@gonzo.ben.algroup.co.uk> writes:
    >> Example: The S-expression (a b (cd e fgh)) has canonical form
    >> for signing (#1:a#1:b(#2:cd#1:e#3:fgh))

    Ben> Seems to me that the # is redundant, and should, therefore,
    Ben> be left out.


  If we want to be as nice to the parser as possible, then let's
indicate the number of items in each S-expression, and/or its size (or
  The only difference between the format that I proposed several weeks
ago, and the format above is that my format would look more like:

  with the knowledge of what is in the () available only to
applications that know what the 'a' tag is. 
  The other major difference is that my tags were fixed length, with
the size set to 4. The length field was also fixed, while this one is
variable size.

  I frankly don't care.
  One thing that I can see about this format is that I can see doing 
a lot of things "inline" ... without additional storage. 
	XX = binary short representation for 1
	YY = binary short representation for 2
	ZZ = binary short representation for 3
	AA = 2^16 || XX

  then, once you have the tree decoded, you simply have a packed array
of elements like:
	struct atom { short atom:1; short len:15; char displayname[]; };

  I note that with a hex external representation, there is always
enough space to store a binary, plus one bit for atom/sublist.
  One can even accumulate the binary representation inplace on byte
addressable big endian machines.
  (systems with alignment issues loose)

   :!mcr!:            |  Network security consulting and 
   Michael Richardson |      contract programming
 WWW: <A HREF="http://www.sandelman.ottawa.on.ca/People/Michael_Richardson/Bio.html">mcr@sandelman.ottawa.on.ca</A>. PGP key available.

Version: 2.6.3ia
Charset: latin1
Comment: Processed by Mailcrypt 3.4, an Emacs/PGP interface


Follow-Ups: References: