-
Notifications
You must be signed in to change notification settings - Fork 32
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
Fixed length encoding of integer numbers #106
Comments
CBOR is a data representation format. Usually, information of this kind is represented in a data definition (or schema). |
I just wanted to stick to any standard or pre-defined regulation if existing.
In my current case I just want to keep an (external) index of pointers to items within a CBOR structure. It would be easier if changing a number value somewhere in the CBOR data would not lead to a change of the byte length. Actually I have found a workaround meanwhile, but accidently posted it in wrong thread:
What I've tried here is to encode a single unsigned 32-bit integer number.
|
This doesn't parse:
Tag 70 is also defined to contain a byte string (and that in little-endian), so you probably want to use:
Generally, the idea to use tagged arrays in place of specific data items is useful; the only limitation is that you no longer can see whether an array was actually intended. In this case,
does the same (the number is actually in big-endian). |
Yes, sorry, my example was not correct. |
I've already asked a similar question (#101 (comment)).
Is there a concept in CBOR to encode integers in a fixed byte length (e.g.
BYTE
,INT16
,INT32
, ...)?I haven't found anything helpful yet. Perhaps it would make sense to define a CBOR tag for this purpose, but I am not a low level programming expert. So I can't say what needs to considered when defining this kind of (primitive) data type.
Background of this issue is the need for a CBOR data structure whose length is not changed when an integer value is altered.
The text was updated successfully, but these errors were encountered: