Botan  1.11.15
src/lib/block/rc5/rc5.h
Go to the documentation of this file.
00001 /*
00002 * RC5
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_RC5_H__
00009 #define BOTAN_RC5_H__
00010 
00011 #include <botan/block_cipher.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * RC5
00017 */
00018 class BOTAN_DLL RC5 : public Block_Cipher_Fixed_Params<8, 1, 32>
00019    {
00020    public:
00021       void encrypt_n(const byte in[], byte out[], size_t blocks) const;
00022       void decrypt_n(const byte in[], byte out[], size_t blocks) const;
00023 
00024       void clear();
00025       std::string name() const;
00026       BlockCipher* clone() const { return new RC5(rounds); }
00027 
00028       /**
00029       * @param rounds the number of RC5 rounds to run. Must be between
00030       * 8 and 32 and a multiple of 4.
00031       */
00032       RC5(size_t rounds);
00033    private:
00034       void key_schedule(const byte[], size_t);
00035 
00036       size_t rounds;
00037       secure_vector<u32bit> S;
00038    };
00039 
00040 }
00041 
00042 #endif