8#include <botan/cascade.h>
15 size_t c1_blocks = blocks * (
block_size() / cipher1->block_size());
16 size_t c2_blocks = blocks * (
block_size() / cipher2->block_size());
18 cipher1->encrypt_n(in, out, c1_blocks);
19 cipher2->encrypt_n(out, out, c2_blocks);
25 size_t c1_blocks = blocks * (
block_size() / cipher1->block_size());
26 size_t c2_blocks = blocks * (
block_size() / cipher2->block_size());
28 cipher2->decrypt_n(in, out, c2_blocks);
29 cipher1->decrypt_n(out, out, c1_blocks);
32void Cascade_Cipher::key_schedule(
const byte key[],
size_t)
48 return "Cascade(" + cipher1->name() +
"," + cipher2->name() +
")";
59size_t euclids_algorithm(
size_t a,
size_t b)
71size_t block_size_for_cascade(
size_t bs,
size_t bs2)
76 size_t gcd = euclids_algorithm(bs, bs2);
78 return (bs * bs2) /
gcd;
84 cipher1(c1), cipher2(c2)
virtual size_t block_size() const =0
void encrypt_n(const byte in[], byte out[], size_t blocks) const
Cascade_Cipher(BlockCipher *cipher1, BlockCipher *cipher2)
BlockCipher * clone() const
size_t block_size() const
void decrypt_n(const byte in[], byte out[], size_t blocks) const
void set_key(const SymmetricKey &key)
size_t maximum_keylength() const
BigInt gcd(const BigInt &a, const BigInt &b)
Internal_Error(const std::string &err)