pub fn generator(prs: &[u8], ci: &[u8], sid: &[u8]) -> [u8; 32]Expand description
Derives the CPace generator for this PRS, CI and sid.
Returns the generator’s u-coordinate as 32 little-endian bytes, the encoding every group
element in CPace uses. PRS is the pairing code’s bytes, CI the channel identifier (empty
when the parties are identified by their associated data instead) and sid the session id.
The function is total: every input hashes to a field element, and Elligator 2 maps every field element to a curve point.
§Example
use syncspin_core::pairing::pake::generator;
// Draft §B.1.1, X25519 with SHA-512.
let sid = [
0x7e, 0x4b, 0x47, 0x91, 0xd6, 0xa8, 0xef, 0x01, 0x9b, 0x93, 0x6c, 0x79, 0xfb, 0x7f,
0x2c, 0x57,
];
let g = generator(b"Password", b"\x0bA_initiator\x0bB_responder", &sid);
assert_eq!(
g,
[
0xd0, 0x4b, 0xf6, 0xd4, 0x1f, 0x6a, 0x28, 0x96, 0x32, 0xa2, 0xe9, 0x29, 0xfa, 0x29,
0xbe, 0xbd, 0x51, 0x09, 0x25, 0x12, 0xa7, 0x82, 0x9f, 0xdd, 0xe7, 0xd3, 0x14, 0xb6,
0x2f, 0x05, 0xa7, 0x3f,
]
);