From b3c10424a49309285a54dea14644b3fba79e59ae Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 8 Nov 2023 22:27:12 +0100 Subject: [PATCH] Add an `xtime` implementation --- aes/aes.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/aes/aes.cpp b/aes/aes.cpp index 82ba954..669b72e 100644 --- a/aes/aes.cpp +++ b/aes/aes.cpp @@ -100,7 +100,16 @@ void shiftRows(t_state s) { } uint8_t xtime(uint8_t a) { - return 0; /* ??? */ + uint8_t mask; + + if (a & 0b10000000) { + mask = 0x1B; + } + else { + mask = 0x00; + } + + return ((a << 1) ^ mask) & 0xFF; } // not mandatory - mix a single column