[Botan-devel] Small file ciphering speed

Mr Diggilin mr.diggilin at gmail.com
Thu Sep 25 04:02:36 EDT 2008

This is all very good news. Those timings are particularly nice, I'm
looking forward to testing an implementation with the database.
Unfortunately, I wasn't able to compile your example as given, since I
didn't have a "botan/loadstore.h". I'm using botan 1.6.4 from the
openSUSE repositories, so perhaps that's not available till a later
That just to say that I had to change some things to get it to compile,
all quite quickly, since I was short on time.
I couldn't immediately find a good way to set the salt without that
store_le function, so I just hardcoded the salt "salt=1" (doing so in
the loop made the execution time an order of magnitude slower, so I just
placed it outside). The new_random_salt had only one "version" taking a
u32bit for how many bytes so I just removed the rng argument. Finally,
the compiler complained about the next_byte function of the random
number generator, so I swapped it out with the loop variable "j".

After fixing the above and removing any semblance of purity from it, I
ran it and was somewhat disturbed but not too surprised to find my time
at 1.863 seconds. I'm not sure how much of a difference the salt setting
takes, but it may add some time if that isn't hardcoded. In general I
can get 3 mbps on a large (200mb) file with Twofish/EAX (~2 times that
using CBC without auth), which seems very low, indicating something else
may not be doing well on this machine in general. Note that that speed
is measuring nothing but start_msg() to end_msg().
As for raw cipher speed not including initialization in this case...
Encryption: 671 ms
Decrypt/compare: 701 ms
A bit of calculation guesstimates that at a bit less than 1mbps.

I'm hoping to get it working in the program soon to see what kind of
speeds I'll get in real life. Is there a good way of putting an int in a
MemoryVector while lacking store_le?

Thank you very much for all your time and how helpful you've been, I'm
truly thankful.

On Wed, 2008-09-24 at 09:34 -0400, Jack Lloyd wrote:
> I am not sure about the Core duo specifically, as I have not used one,
> but I spent the early morning implementing a Row_Encryptor class along
> with a test/benchmark prog. On my Core2 Duo 2.4 Ghz processor using
> GCC, it took .4 seconds to generate 15000 records, encrypt them all
> (Twofish/EAX), and then decrypt them all and check them against the
> originals (this also includes process startup, randomness polling,
> etc). On my 2 GHz Pentium 4-M (keep in mind this is an old Netburst,
> so probably comparable to a ~1.2 GHz P3 in a lot of ways) running
> Windows XP using Visual C++ 2008, it took about 1.2 seconds to do the
> same thing, and .9 seconds when I switched to using AES-128.

> Of course once disk loads come into play latency can grow quickly, but
> Sqlite is supposed to be reasonably fast, so your goal of 3 seconds
> seems pretty achievable.
> <snip>

More information about the botan-devel mailing list