Crate aes_wasm

Source
Expand description

§aes-wasm

High-performance AEAD, stream cipher, and MAC primitives for WebAssembly/WASI.

This crate provides a simple, dependency-free API for cryptography in WASI environments.

§Example: AES-128-GCM

use aes_wasm::aes128gcm::{encrypt, decrypt, Key, Nonce};
let key = Key::default();
let nonce = Nonce::default();
let msg = b"hello world";
let ad = b"extra data";
let ciphertext = encrypt(msg, ad, &key, nonce);
let plaintext = decrypt(ciphertext, ad, &key, nonce).unwrap();
assert_eq!(plaintext, msg);

AEAD ciphers for WebAssembly, including AEGIS, AES-GCM, AES-OCB, AES-CBC, AES-CTR, and CMAC.

This crate provides high-performance AEAD and MAC primitives for use in WebAssembly environments. It exposes a simple API for encryption, decryption, and authentication using modern ciphers.

§Example

use aes_wasm::aes128gcm::{encrypt, decrypt, Key, Nonce};
let key = Key::default();
let nonce = Nonce::default();
let msg = b"hello";
let ad = b"ad";
let ciphertext = encrypt(msg, ad, &key, nonce);
let plaintext = decrypt(ciphertext, ad, &key, nonce).unwrap();
assert_eq!(plaintext, msg);

Modules§

aegis256
AEGIS-256 AEAD cipher for WASI (WebAssembly System Interface).
aegis128l
AEGIS-128L AEAD cipher for WASI (WebAssembly System Interface).
aegis128x2
AEGIS-128X2 AEAD cipher for WASI (WebAssembly System Interface).
aegis128x4
AEGIS-128X4 AEAD cipher for WASI (WebAssembly System Interface).
aegis256x2
AEGIS-256X2 AEAD cipher for WASI (WebAssembly System Interface).
aegis256x4
AEGIS-256X4 AEAD cipher for WASI (WebAssembly System Interface).
aes128cbc
AES-128-CBC block cipher for WASI (WebAssembly System Interface).
aes128ctr
AES-128-CTR stream cipher for WASI (WebAssembly System Interface).
aes128gcm
AES-128-GCM AEAD cipher for WASI (WebAssembly System Interface).
aes128ocb
AES-128-OCB AEAD cipher for WASI (WebAssembly System Interface).
aes256cbc
AES-256-CBC block cipher for WASI (WebAssembly System Interface).
aes256ctr
AES-256-CTR stream cipher for WASI (WebAssembly System Interface).
aes256gcm
AES-256-GCM AEAD cipher for WASI (WebAssembly System Interface).
aes256ocb
AES-256-OCB AEAD cipher for WASI (WebAssembly System Interface).
cmac_aes128
CMAC-AES-128 message authentication code for WASI (WebAssembly System Interface).

Enums§

Error
Error type for AEAD operations.