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.
fnXChaChaIETF(comptimerounds_nb: usize) type {
returnstruct {
/// Nonce length in bytes.pubconstnonce_length = 24;
/// Key length in bytes.pubconstkey_length = 32;
/// Block length in bytes.pubconstblock_length = 64;
/// Add the output of the XChaCha20 stream cipher to `in` and stores the result into `out`./// WARNING: This function doesn't provide authenticated encryption./// Using the AEAD or one of the `box` versions is usually preferred.pubfnxor(out: []u8, in: []constu8, counter: u32, key: [key_length]u8, nonce: [nonce_length]u8) void {
constextended = extend(key, nonce, rounds_nb);
ChaChaIETF(rounds_nb).xor(out, in, counter, extended.key, extended.nonce);
}
/// Write the output of the XChaCha20 stream cipher into `out`.pubfnstream(out: []u8, counter: u32, key: [key_length]u8, nonce: [nonce_length]u8) void {
constextended = extend(key, nonce, rounds_nb);
ChaChaIETF(rounds_nb).stream(out, counter, extended.key, extended.nonce);
}
};
}