k256::ecdsa::hazmat

Function bits2field

Source
pub fn bits2field<C>(
    bits: &[u8],
) -> Result<GenericArray<u8, <C as Curve>::FieldBytesSize>, Error>
where C: PrimeCurve,
Expand description

Partial implementation of the bits2int function as defined in RFC6979 § 2.3.2 as well as SEC1 § 2.3.8.

This is used to convert a message digest whose size may be smaller or larger than the size of the curve’s scalar field into a serialized (unreduced) field element.