You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So that people can have repeatable canonical binary serializations of a json/cbor object, add a sort_keys=True feature to dump()/dumps()
Follow "Canonical CBOR" section 3.9 rules for sorting
The text was updated successfully, but these errors were encountered:
The sorting rules in 3.9 of RFC7049 are rather explicit, relate to the encoded version of the key elements, and are most importantly not compatible with sorting unicode keys, because they specify that short representations come before long ones (something like len(a) < len(b) if len(a) != len(b) else a < b).
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. (Note that this rule allows maps that have keys of
different types, even though that is probably a bad practice that
could lead to errors in some canonicalization implementations.)
The sorting rules are:
* If two keys have different lengths, the shorter one sorts
earlier;
* If two keys have the same length, the one with the lower value
in (byte-wise) lexical order sorts earlier.
So that people can have repeatable canonical binary serializations of a json/cbor object, add a
sort_keys=True
feature to dump()/dumps()Follow "Canonical CBOR" section 3.9 rules for sorting
The text was updated successfully, but these errors were encountered: