authorgravatar for 30444886+margual56@users.noreply.github.comMarcos Gutiérrez Alonso <30444886+margual56@users.noreply.github.com> 2025-07-13 09:33:08+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-07-13 07:33:08+00:00
logf97baca6f6288eb786fe3546292465ef76310810
treec99730226a3ac55f1bcbd7af478acb6833b3047f
parent3974540e5a1226acf9f30b43dc5a7f4fa1a16041
signaturebadge-check Signed by PGP key B5690EEEBB952194

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


1 files changed, 6 insertions(+), 0 deletions(-)

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