[Botan-devel] Small file ciphering speed

Mr Diggilin mr.diggilin at gmail.com
Wed Sep 17 20:43:27 EDT 2008


I'm trying to use botan for encryption and decryption of thousands of
database rows with very little data (~50 bytes) in them. What I'm doing
currently takes about 1/4th of a second per field, which is *much*
slower than would make this practical. I have a few thoughts on how to
optimize, but I thought I'd ask here first to find out:
a. What's a good way of doing this with Botan?
b. What kind of speed can I expect?
c. I'm using an S2K with 100 hash rounds for each operation, which isn't
much. Would there be any security concerns if I reused the same key
(with more rounds) over all of the thousands of entries?

My current de/ciphering routine as follows:

auto_ptr<Pipe> Crypto::RunCipher(string Passphrase, wxInputStream * In,
SecureVector<byte>& Salt)
{
  Cipher_Dir Dir = (Salt == NULL) ? ENCRYPTION : DECRYPTION;
  KeyAndIV = 100 round s2k;
  SymmetricKey Key(KeyAndIV, KeySize); //256 key
  InitializationVector IV(KeyAndIV + KeySize, IVSize); //128 IV
  auto_ptr<Pipe> Out(new Pipe(get_cipher("Twofish/EAX", Key, IV,
Dir)));
  Out->start_msg();
  *In >> *Out;
  Out->end_msg();
  return Out;
}




More information about the botan-devel mailing list