Tweak to canonicalization section.

This commit is contained in:
Tony Garnock-Jones 2019-08-18 14:22:55 +01:00
parent 5e89bfb2ca
commit 3556c98346
1 changed files with 5 additions and 3 deletions

View File

@ -169,7 +169,7 @@ out the elements in the same order, every time.
When combined with binary serialization, this is Preserves' "canonical
form".
This is important and useful for many contexts, but especially for
cryptographic signatures.
cryptographic signatures and hashing.
#+BEGIN_SRC preserves
@"This hand-typed Preserves document..."
@ -185,8 +185,10 @@ cryptographic signatures.
"noise": "ooh-ooh"}}
#+END_SRC
This is a bit more expensive than normal serialization (because
sorting needs to occur), but is still quite fast in general.
Clever implementations can get canonicalized output for free by
carefully ordering set elements and dictionary entries at construction
time, but even in simple implementations, canonical serialization is
almost as cheap as normal serialization.
** Defining our own types using Records