From 8bfeb9729f95ed0d7f384bc8f0e476840a115e3f Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 12 Dec 2023 19:05:19 +0100 Subject: [PATCH] Read number of runs from arguments --- aes-32bit/aes.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aes-32bit/aes.cpp b/aes-32bit/aes.cpp index 2b3d10f..f1114fa 100644 --- a/aes-32bit/aes.cpp +++ b/aes-32bit/aes.cpp @@ -188,12 +188,16 @@ void aes(uint8_t *in, uint8_t *out, uint8_t *skey) //**************************** int main(int argc, char* argv[]) { + uint32_t cycles = 1000000; + if (argc > 2) { std::cerr << "Invalid number of arguments\n"; exit(EXIT_FAILURE); + } else if (argc == 2) { + cycles = std::atoi(argv[1]); } - for (int i = 0; i < 1000000; i++) { + for (int i = 0; i < cycles; i++) { uint8_t key[16] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff }; uint8_t in[16] = { 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67, 0x89}; aes(in, in, key);