Add Canonicalization
The user facing API is in MessageReader and MessageBuilder {MessageBuilder,MessageReader}::isCanonical verifies the canonicity of a message. This is both useful for debugging and for knowing if a received message can be used for hashes, bytewise equality, etc. MessageBuilder::canonicalRoot(Reader) can be used to write a canonical message on a best effort basis, and checks itself using isCanonical. It should succeed as long as the MessageBuilder in question: * Has a first segment which is long enough to contain the message * Has not been used before Tests have been added in canonicalize-test.c++ which verify that for crafted examples of canonicalization errors, isCanonical will reject, and for a canonicalized version of the standard test message, it will accept.
Showing
This diff is collapsed.
Please
register
or
sign in
to comment