Crate aegis

source ·
Expand description

§AEGIS for Rust

This is a Rust implementation of the AEGIS authenticated ciphers.

AEGIS is extremely fast on CPUs with AES acceleration, has a large nonce size, and is key committing.

§API documentation

§Cargo flags

  • std: allow dynamic allocations

std is the default.

  • pure-rust: don’t use the cc crate to take advantage of the implementations from libaegis. Setting this flag will substantially degrade performance, and parallel variants will not be available.

A benchmark can be run that way:

export RUSTFLAGS="-C target-cpu=native"
cargo bench

If clang or zig cc are present on your system, you can use with:

export CC="zig cc"

or

export CC="clang"

prior to running cargo commands.

§Benchmarks

Benchmarks take a 16384 bytes input block. Results are in bytes per second. RUSTFLAGS is set so that the Rust aes-gcm crate can take advantage of hardware acceleration.

§Rust implementations

Crates:

  • aes-gcm
  • boring
  • chacha20poly1305
  • aegis

§AMD Zen4

rust 1.73, zig cc 0.11

cipherspeed
aes128-gcm (aes-gcm crate)2.19 G/s
aes256-gcm (aes-gcm crate)2.03 G/s
chacha20-poly13052.00 G/s
aes256-gcm (boring crate)5.93 G/s
aes128-gcm (boring crate)6.33 G/s
aegis25615.40 G/s
aegis256x230.60 G/s
aegis256x446.17 G/s
aegis128l26.16 G/s
aegis128x250.35 G/s
aegis128x466.22 G/s

§Macbook Pro - Apple M1

rust 1.73, Xcode

cipherspeed
aes256-gcm (aes-gcm crate)0.13 G/s
aes128-gcm (aes-gcm crate)0.17 G/s
chacha20-poly13050.26 G/s
aes256-gcm (boring crate)5.14 G/s
aes128-gcm (boring crate)6.08 G/s
aegis2567.94 G/s
aegis256x210.56 G/s
aegis256x411.20 G/s
aegis128l14.27 G/s
aegis128x215.98 G/s
aegis128x412.01 G/s

§AWS t4g (aarch64, Graviton)

rust 1.74, clang 15

cipherspeed
aes256-gcm (aes-gcm crate)0.05 G/s
aes128-gcm (aes-gcm crate)0.06 G/s
chacha20-poly13050.10 G/s
aes256-gcm (boring crate)1.79 G/s
aes128-gcm (boring crate)2.12 G/s
aegis2563.14 G/s
aegis128l4.30 G/s

§WebAssembly (Wasmtime, Zen4)

cipherspeed
aes256-gcm62.97 M/s
aes128-gcm73.83 M/s
chacha20-poly130588.92 M/s
aegis128l537.49 M/s

§WebAssembly (Wasmtime, Apple M1)

cipherspeed
aes256-gcm49.43 M/s
aes128-gcm59.37 M/s
chacha20-poly1305177.85 M/s
aegis128l533.85 M/s

Modules§

Enums§