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
{{ message }}
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.
The IETF spec describing the I2OSP function describes it as returning an error for invalid (too small) n. This would probably make sense; otherwise, it produces truncated results. e.g., I2OSP(65536, 2) produces 0x01, 0x00, which would be converted back to 256, not 65536.
It might be possible to do this more cleanly with math/bits.Len64() and encoding/binary/BigEndian.PutUint64.
The direct uses of this function in the library don't seem to run into this (they're mostly calling it with small values like 0, 1, or the length in bytes of a hash), but since the symbol is exported, and the library's stated goal is to be hard-to-misuse, it should probably be returning an error explicitly when invoked with invalid parameters.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The IETF spec describing the I2OSP function describes it as returning an error for invalid (too small) n. This would probably make sense; otherwise, it produces truncated results. e.g., I2OSP(65536, 2) produces 0x01, 0x00, which would be converted back to 256, not 65536.
It might be possible to do this more cleanly with math/bits.Len64() and encoding/binary/BigEndian.PutUint64.
The direct uses of this function in the library don't seem to run into this (they're mostly calling it with small values like 0, 1, or the length in bytes of a hash), but since the symbol is exported, and the library's stated goal is to be hard-to-misuse, it should probably be returning an error explicitly when invoked with invalid parameters.
The text was updated successfully, but these errors were encountered: