Type Function XSalsa [src]
Alias for std.crypto.salsa20.XSalsa
The XSalsa stream cipher.
Prototype
pub fn XSalsa(comptime rounds: comptime_int) type
Parameters
rounds: comptime_int
Source
pub fn XSalsa(comptime rounds: comptime_int) type {
return struct {
/// Nonce length in bytes.
pub const nonce_length = 24;
/// Key length in bytes.
pub const key_length = 32;
/// Add the output of the XSalsa 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.
pub fn xor(out: []u8, in: []const u8, counter: u64, key: [key_length]u8, nonce: [nonce_length]u8) void {
const extended = extend(rounds, key, nonce);
Salsa(rounds).xor(out, in, counter, extended.key, extended.nonce);
}
};
}