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/ › ml_dsa.zig › testKeyGenerationBasic
testKeyGenerationBasic
ml_dsa.testKeyGenerationBasic
fn testKeyGenerationBasic (comptime MlDsa : type , seed : [32 ]u8 ) !void
File
Code
fn testKeyGenerationBasic (comptime MlDsa : type , seed : [32 ]u8 ) !void {
const result = MlDsa .newKeyFromSeed (&seed );
const pk = result .pk ;
const sk = result .sk ;
try testing .expect (pk .rho .len == 32 );
try testing .expect (sk .rho .len == 32 );
try testing .expectEqualSlices (u8 , &pk .rho , &sk .rho );
try testing .expectEqualSlices (u8 , &pk .tr , &sk .tr );
const pk_bytes = pk .toBytes ();
const pk2 = try MlDsa .PublicKey .fromBytes (pk_bytes );
try testing .expectEqualSlices (u8 , &pk .rho , &pk2 .rho );
try testing .expectEqualSlices (u8 , &pk .tr , &pk2 .tr );
const sk_bytes = sk .toBytes ();
const sk2 = try MlDsa .SecretKey .fromBytes (sk_bytes );
try testing .expectEqualSlices (u8 , &sk .rho , &sk2 .rho );
try testing .expectEqualSlices (u8 , &sk .key , &sk2 .key );
try testing .expectEqualSlices (u8 , &sk .tr , &sk2 .tr );
}