Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canonical Encoding #36

Open
ghadishayban opened this issue Jun 9, 2017 · 2 comments
Open

Canonical Encoding #36

ghadishayban opened this issue Jun 9, 2017 · 2 comments

Comments

@ghadishayban
Copy link

ghadishayban commented Jun 9, 2017

Use cases like blockchain transaction payloads and content-addressable storage have a general requirement that securely hashing equivalent information generates the same hash. Has a canonical sort order for map keys been considered?

(There may be other considerations besides key sort order that prevent generating the same hash.)

@ghadishayban
Copy link
Author

Something like IPLD is another interesting use case https://github.com/ipld/specs/tree/master/ipld

@ghadishayban
Copy link
Author

CBOR defines a "canonical encoding" [1] that, among other things, requires:

The keys in every map must be sorted lowest value to highest. Sorting is performed on the bytes of the representation of the key data items without paying attention to the 3/5 bit splitting for major types.

[1] https://tools.ietf.org/html/rfc7049#section-3.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant