Optimize ShiftRows() and InvShiftRows()
[aes.git] / problem3.cpp
1 #include "aes.hpp"
2 #include <fstream>
3 #include <cstdio>
4
5 int main (int argc, char *argv[])
6 {
7         std::ifstream fin ("Problem3.out", ios::binary);
8         int i;
9
10         byteArray key;
11
12         for (i=0; i<24; ++i)
13                 key.push_back (fin.get());
14
15         /* Create the AES Object */
16         AES aes (key);
17
18         byteArray input;
19
20         /* Read the input and decrypt */
21         for (char c=fin.get(); !fin.eof(); c=fin.get())
22         {
23                 input.push_back (c);
24
25                 if (input.size() == 16)
26                 {
27                         byteArray plaintext = aes.decrypt (input);
28
29                         /* Print it */
30                         for (i=0; i<plaintext.size(); ++i)
31                                 std::printf ("%c", plaintext.at(i));
32
33                 input.clear();
34                 }
35         }
36
37         return 0;
38 }
39
40 /* vim: set ts=4 sts=4 sw=4 noet tw=120 nowrap: */