Add documentation to std.crypto.aes_gcm.AesGcm.encrypt (#24427)

This commit is contained in:
Marcos Gutiérrez Alonso 2025-07-13 09:33:08 +02:00 committed by GitHub
parent 3974540e5a
commit f97baca6f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,12 @@ fn AesGcm(comptime Aes: anytype) type {
const zeros = [_]u8{0} ** 16;
/// `c`: The ciphertext buffer to write the encrypted data to.
/// `tag`: The authentication tag buffer to write the computed tag to.
/// `m`: The plaintext message to encrypt.
/// `ad`: The associated data to authenticate.
/// `npub`: The nonce to use for encryption.
/// `key`: The encryption key.
pub fn encrypt(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const u8, npub: [nonce_length]u8, key: [key_length]u8) void {
debug.assert(c.len == m.len);
debug.assert(m.len <= 16 * ((1 << 32) - 2));