Skip to main content

i2osp

Function i2osp 

Source
pub(crate) fn i2osp(input: BoxedUint, padded_len: usize) -> Vec<u8> ⓘ
Expand description

Integer-to-Octet-String Primitive (I2OSP) from RFC8017 §4.1.

Converts input to exactly padded_len big-endian bytes, left-padded with zeros. input must fit in padded_len bytes. This is a caller-established precondition, checked by a debug assertion. Unlike the general RFC primitive, this internal helper does not return an “integer too large” error: callers must establish input < 256^padded_len before calling it.

Use i2osp_zeroizing when encoding secret values.