From d77f4adf04f2878853d0919f908d1b110f3c94f2 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Thu, 10 Apr 2025 19:34:07 +0200 Subject: implement aes4 and aes10 with native instructions Even though aes::hazmat::cipher_round uses aes-ni instructions under the hood, simply loading the data (and the keys!) takes a significant amount of time. Sadly, there's no way that aes exposes that lets you re-use the "loaded" keys. By implementing aes4/aes10 directly with _mm_aesenc, we can keep the keys properly aligned. We still keep the software backend as fallback, using the software implementation of the aes crate. This gives a ~70% speedup. --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index 572e0b3..174ea24 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ repository = "https://codeberg.org/dunj3/zears" aes = { version = "0.8.4", features = ["hazmat"] } blake2 = "0.10.6" constant_time_eq = "0.4.2" +cpufeatures = "0.2.17" [dev-dependencies] hex = "0.4.3" -- cgit v1.2.3