'encrypting large file taking too much time
I am trying to encrypt and decrypt a file using aes 128. Everything works fine but it takes too much time to encrypt a file which is just 165 kb. I checked the whole internet and tried to use different tactics but the result is still same takes 1 minute to encrypt a 165kb file.
here is how I do the reading and encrypting
string keyStr = "abcdefghijklmnop";
byte key[16];
charToByte(key, keyStr.c_str());
//Key expansion
word w[4 * (Nr + 1)];
KeyExpansion(key, w);
bitset<128> data;
byte plain[16];
//Encrypt the file s.csv to s.csv.enc
ifstream in;
ofstream out;
in.open("s.csv", ios::binary);
out.open("s.csv.enc", ios::binary);
while (in.read((char*)&data, sizeof(data)))
{
divideToByte(plain, data);
encrypt(plain, w);
data = mergeByte(plain);
out.write((char*)&data, sizeof(data));
data.reset(); //Set 0
}
in.close();
out.close();
I took the code from: https://programmer.group/c-implementation-of-aes-encryption-algorithms.html
any help is appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
