Skip to content

crypto.aes #

Constants #

const block_size = 16

The AES block size in bytes.

fn new_cipher #

fn new_cipher(key []u8) cipher.Block

new_cipher creates and returns a new [AesCipher]. The key argument should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

fn (AesCipher) free #

unsafe
fn (mut c AesCipher) free()

free the resources taken by the AesCipher c

fn (AesCipher) block_size #

fn (c &AesCipher) block_size() int

block_size returns the block size of the checksum in bytes.

fn (AesCipher) encrypt #

fn (c &AesCipher) encrypt(mut dst []u8, src []u8)

encrypt encrypts the first block of data in src to dst.

Note: dst and src are both mutable for performance reasons.

Note: dst and src must both be pre-allocated to the correct length.

Note: dst and src may be the same (overlapping entirely).

fn (AesCipher) decrypt #

fn (c &AesCipher) decrypt(mut dst []u8, src []u8)

decrypt decrypts the first block of data in src to dst.

Note: dst and src are both mutable for performance reasons.

Note: dst and src must both be pre-allocated to the correct length.

Note: dst and src may be the same (overlapping entirely).