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
Integer endianness #157
Comments
Discussed in the WG call on 2022-06-27. The direction decided is to check available implementations and either ad a note in the definition of OS2IP and I2OSP, describing that they operate in big-endian order (like H2C) or define a |
Discussed on WG call 8th of august, there is currently ambiguity around the endianness of scalar_to_octets that needs to be resolved. |
I ran into this issue as I was going through spec implementation and validating against the provided fixtures. Has there been a decision made? I think at minimum, the fixtures should specify the byte order of the scalar. |
In practice, not a decision here, whenever hexits or base64 are given it represents big endian. |
If we give the actual bytes then little endian is preferable |
The |
Let me clarify, in a spec if they give the actual byte sequence it’s almost always little endian, but when encoded like hex or base64, it’s big endian. Since we rarely give the actual byte sequence, I’d propose to use big endian hexits |
Related to updates in #221 |
As noted by @mikelodder7, in the document we don't yet discuss the integers (i.e., scalars mod r) serialization. More specifically, since we have a description for the byte length of those integers (
octet_scalar_length
), what is missing is the byte order.In general i thing little-endian is preferred (it is mostly used in bls libs like the rust crate and blst) but an issue is that I2OSP uses big-endian if im not mistaken.
There are 3 options i can think of;
octet_scalar_length
in general) in little-endian, with a note for I2OSP.At the moment I'm leaning more towards option 3. Implementations may elect to use any kind of optimization and this will allow for that.
Also for what i know of, other specs like ecdsa and eddsa elect to define the integer's endianness but specs like bls-sigs and h2c adopt option 3, so it does not seem to be any "absolutely correct" way to do that.
The text was updated successfully, but these errors were encountered: