Zig 0.17.0-dev (Split by item)
This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig library itself.
Zig › std/ › crypto/ › hybrid_kem.zig › X25519Group
X25519Group
hybrid_kem.X25519Group
const X25519Group = struct
File
Code
const X25519Group = struct {
pub const seed_length = 32 ;
pub const element_length = 32 ;
pub const scalar_length = 32 ;
pub fn randomScalar (seed : []const u8 ) ![scalar_length ]u8 {
if (seed .len < scalar_length ) return error .InsufficientSeed ;
return seed [0 ..scalar_length ].*;
}
pub fn mulBase (scalar : [scalar_length ]u8 ) ![element_length ]u8 {
return X25519 .recoverPublicKey (scalar );
}
pub fn mul (point : [element_length ]u8 , scalar : [scalar_length ]u8 ) ![scalar_length ]u8 {
return X25519 .scalarmult (scalar , point );
}
pub fn elementToSharedSecret (ss : [scalar_length ]u8 ) [scalar_length ]u8 {
return ss ;
}
pub fn encodePoint (p : [element_length ]u8 ) [element_length ]u8 {
return p ;
}
pub fn decodePoint (bytes : *const [element_length ]u8 ) [element_length ]u8 {
return bytes .*;
}
}