Botan
1.11.15
|
00001 /* 00002 * CAST-128 00003 * (C) 1999-2007 Jack Lloyd 00004 * 00005 * Botan is released under the Simplified BSD License (see license.txt) 00006 */ 00007 00008 #ifndef BOTAN_CAST128_H__ 00009 #define BOTAN_CAST128_H__ 00010 00011 #include <botan/block_cipher.h> 00012 00013 namespace Botan { 00014 00015 /** 00016 * CAST-128 00017 */ 00018 class BOTAN_DLL CAST_128 : public Block_Cipher_Fixed_Params<8, 11, 16> 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 { return "CAST-128"; } 00026 BlockCipher* clone() const { return new CAST_128; } 00027 00028 private: 00029 void key_schedule(const byte[], size_t); 00030 00031 static void cast_ks(secure_vector<u32bit>& ks, 00032 secure_vector<u32bit>& user_key); 00033 00034 secure_vector<u32bit> MK; 00035 secure_vector<byte> RK; 00036 }; 00037 00038 } 00039 00040 #endif