Explain same encryption time for two files of different sizes I am encrypting files in a two layered fashion as follows:


Inner layer is 128 bit AES-CTR encryption
Outer/Second layer is a simple one time padding with a particular key.


While testing the running times I noticed that it takes same time to encrypt a 100kB file as it takes to encrypt a 10kB file. Logically it seems wrong to me, is it something that I am missing ?
Modern computers are quite fast, and modern cryptographic algorithms are quite efficient.

Most computers benchmark hardware accelerated AES in CTR mode well above 1GB/s, which would be a fraction of a millisecond for a 100KiB file. Since the standard system timer generally runs at 1ms intervals, the entire encryption operation ([file data] XOR [AES] XOR [Pad]) will take less than a single timer 'tick' to complete, and they will report the same completion time.

I would expect files up to 3 MiB will take less than 1ms to complete on computers made in the last 5 years, if the timer is started after the file data is read from disk, just prior to encryption.

Try using a much larger file, at least 1 GiB, in order to gauge the performance of the system. Also, Windows offers a high resolution timer through the kernel, if the hardware supports it, offering sub-microsecond accuracy. If you try to repeatedly measure very small time windows, they will vary greatly if there are other processes using the same CPU core.