Botan  1.11.15
src/lib/block/threefish/threefish.h
Go to the documentation of this file.
00001 /*
00002 * Threefish
00003 * (C) 2013,2014 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_THREEFISH_H__
00009 #define BOTAN_THREEFISH_H__
00010 
00011 #include <botan/block_cipher.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * Threefish-512
00017 */
00018 class BOTAN_DLL Threefish_512 : public Block_Cipher_Fixed_Params<64, 64>
00019    {
00020    public:
00021       void encrypt_n(const byte in[], byte out[], size_t blocks) const override;
00022       void decrypt_n(const byte in[], byte out[], size_t blocks) const override;
00023 
00024       void set_tweak(const byte tweak[], size_t len);
00025 
00026       void clear() override;
00027       std::string name() const override { return "Threefish-512"; }
00028       BlockCipher* clone() const override { return new Threefish_512; }
00029    protected:
00030       const secure_vector<u64bit>& get_T() const { return m_T; }
00031       const secure_vector<u64bit>& get_K() const { return m_K; }
00032    private:
00033       void key_schedule(const byte key[], size_t key_len) override;
00034 
00035       // Interface for Skein
00036       friend class Skein_512;
00037 
00038       virtual void skein_feedfwd(const secure_vector<u64bit>& M,
00039                                  const secure_vector<u64bit>& T);
00040 
00041       // Private data
00042       secure_vector<u64bit> m_T;
00043       secure_vector<u64bit> m_K;
00044    };
00045 
00046 }
00047 
00048 #endif