From 28a8753d55705cad15a4e809590e629529f73214 Mon Sep 17 00:00:00 2001 From: 0xalivecow Date: Wed, 30 Oct 2024 18:00:09 +0100 Subject: [PATCH] feat: add test case for XEX empty --- src/utils/ciphers.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/utils/ciphers.rs b/src/utils/ciphers.rs index 6ffa52a..a9548e8 100644 --- a/src/utils/ciphers.rs +++ b/src/utils/ciphers.rs @@ -167,4 +167,17 @@ mod tests { Ok(()) } + + #[test] + fn test_xex_encrypt_empty_case() -> Result<()> { + let key = BASE64_STANDARD.decode("B1ygNO/CyRYIUYhTSgoUysX5Y/wWLi4UiWaVeloUWs0=")?; + let tweak = BASE64_STANDARD.decode("6VXORr+YYHrd2nVe0OlA+Q==")?; + let input = BASE64_STANDARD.decode("")?; + + let output = BASE64_STANDARD.encode(xex_encrypt(key, &tweak, &input)?); + + assert_eq!(output, ""); + + Ok(()) + } }