Function toCompressedSec1 [src]
Serialize a point using the compressed SEC-1 format.
Prototype
pub fn toCompressedSec1(p: P256) [33]u8
Parameters
p: P256
Source
pub fn toCompressedSec1(p: P256) [33]u8 {
var out: [33]u8 = undefined;
const xy = p.affineCoordinates();
out[0] = if (xy.y.isOdd()) 3 else 2;
out[1..].* = xy.x.toBytes(.big);
return out;
}