RFC 8610, appendix G.3 states the following:
Where a byte string is to carry an embedded CBOR-encoded item, or more generally a sequence of zero or more such items, the diagnostic notation for these zero or more CBOR data items, separated by commas, can be enclosed in << and >> to notate the byte string resulting from encoding the data items and concatenating the result. For instance, each pair of columns in the following are equivalent:
<<1>> h'01'
<<1, 2>> h'0102'
<<"foo", null>> h'63666F6FF6'
<<>> h''
It is my understanding that the diagnostic notation refers to an encoding scheme where each element appearing between << >>
is first encoded to a byte array. Then, all the values are concatenated together. Furthermore, I have inspected implementations that seem to conform to the standard, and this is the be
Question: Is this encoding injective(non-ambigous)? Is it always the case that <<a,b,c>>
will produce a different result than <<a',b', c'>>
for instance? The values a', b', c'
can be chosen arbitrarily(perhaps maliciously).