#aes-gcm #encryption #stream-cipher #cmac #aes-ctr

aes-wasm

AES-GCM, AES-OCB, AEGIS, AES-CTR, CMAC-AES for WebAssembly

13 releases

new 0.1.12 Dec 9, 2024
0.1.11 Sep 3, 2024
0.1.10 May 9, 2024
0.1.9 Feb 22, 2024
0.1.4 May 30, 2023

#671 in WebAssembly

Download history 101/week @ 2024-08-28 62/week @ 2024-09-04 14/week @ 2024-09-11 17/week @ 2024-09-18 15/week @ 2024-09-25 3/week @ 2024-10-02 1/week @ 2024-10-09 5/week @ 2024-10-30 6/week @ 2024-11-06 3/week @ 2024-11-13 8/week @ 2024-11-20 5/week @ 2024-11-27 104/week @ 2024-12-04

120 downloads per month

MIT license

225KB
1.5K SLoC

Rust 1K SLoC Zig 294 SLoC // 0.0% comments

Contains (static library, 185KB) wasm-libs/libaes.a

Docs.rs crates.io

Fast(er) AES-based constructions for Rust and WebAssembly

  • AEGIS-128L
  • AEGIS-256
  • AES-128-CTR
  • AES-256-CTR
  • AES-128-OCB
  • AES-256-OCB
  • AES-128-GCM
  • AES-256-GCM
  • AES-128-CBC with PKCS#7 padding
  • AES-256-CBC with PKCS#7 padding
  • CMAC-AES-128

This is a set of AES-based constructions (AEAD, stream cipher, MAC) for WebAssembly applications written in Rust.

They are trivial to use and this crate has zero dependencies.

Benchmarks

Benchmarks can be run with the cargo wasix bench command.

Performance results using Wasmtime 9.0.1 on Apple M1

algorithm crate throughput
aes256-gcm (aes crate) 49.63 M/s
aes256-gcm this crate 98.86 M/s
aes128-gcm (aes crate) 59.87 M/s
aes128-gcm this crate 115.47 M/s
aes256-ocb this crate 168.43 M/s
aes128-ocb this crate 215.23 M/s
aes-128-cbc (cbc crate) 48.48 M/s
aes-128-cbc this crate 225.63 M/s
aes-256-cbc (cbc crate) 35.49 M/s
aes-256-cbc this crate 171.89 M/s
aegis-256 this crate 478.57 M/s
aegis-128l (aegis crate) 533.85 M/s
aegis-128l this crate 695.85 M/s
aes128-ctr (ctr crate) 104.63 M/s
aes128-ctr this crate 217.10 M/s
cmac-aes128 (cmac crate) 53.99 M/s
cmac-aes128 this crate 233.34 M/s

Performance results using Wasmtime 9.0.1 on Ryzen 7

algorithm crate throughput
aes256-gcm (aes crate) 63.79 M/s
aes256-gcm this crate 129.44 M/s
aes128-gcm (aes crate) 75.09 M/s
aes128-gcm this crate 149.31 M/s
aes256-ocb this crate 205.39 M/s
aes128-ocb this crate 260.56 M/s
aegis-256 this crate 497.97 M/s
aegis-128l (aegis crate) 537.49 M/s
aegis-128l this crate 696.61 M/s
aes128-ctr (ctr crate) 151.26 M/s
aes128-ctr this crate 275.51 M/s
cmac-aes128 (cmac crate) 78.63 M/s
cmac-aes128 this crate 260.23 M/s

No runtime deps