diff options
Diffstat (limited to 'src/cipher/tea')
-rw-r--r-- | src/cipher/tea/info.txt | 10 | ||||
-rw-r--r-- | src/cipher/tea/tea.cpp | 56 | ||||
-rw-r--r-- | src/cipher/tea/tea.h | 32 |
3 files changed, 0 insertions, 98 deletions
diff --git a/src/cipher/tea/info.txt b/src/cipher/tea/info.txt deleted file mode 100644 index 6a0e76b15..000000000 --- a/src/cipher/tea/info.txt +++ /dev/null @@ -1,10 +0,0 @@ -realname "TEA" - -define TEA - -load_on auto - -<add> -tea.cpp -tea.h -</add> diff --git a/src/cipher/tea/tea.cpp b/src/cipher/tea/tea.cpp deleted file mode 100644 index c5bd1b1fa..000000000 --- a/src/cipher/tea/tea.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************* -* TEA Source File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#include <botan/tea.h> -#include <botan/loadstor.h> - -namespace Botan { - -/************************************************* -* TEA Encryption * -*************************************************/ -void TEA::enc(const byte in[], byte out[]) const - { - u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); - - u32bit S = 0; - for(u32bit j = 0; j != 32; ++j) - { - S += 0x9E3779B9; - L += ((R << 4) + K[0]) ^ (R + S) ^ ((R >> 5) + K[1]); - R += ((L << 4) + K[2]) ^ (L + S) ^ ((L >> 5) + K[3]); - } - - store_be(out, L, R); - } - -/************************************************* -* TEA Decryption * -*************************************************/ -void TEA::dec(const byte in[], byte out[]) const - { - u32bit L = load_be<u32bit>(in, 0), R = load_be<u32bit>(in, 1); - - u32bit S = 0xC6EF3720; - for(u32bit j = 0; j != 32; ++j) - { - R -= ((L << 4) + K[2]) ^ (L + S) ^ ((L >> 5) + K[3]); - L -= ((R << 4) + K[0]) ^ (R + S) ^ ((R >> 5) + K[1]); - S -= 0x9E3779B9; - } - - store_be(out, L, R); - } - -/************************************************* -* TEA Key Schedule * -*************************************************/ -void TEA::key(const byte key[], u32bit) - { - for(u32bit j = 0; j != 4; ++j) - K[j] = load_be<u32bit>(key, j); - } - -} diff --git a/src/cipher/tea/tea.h b/src/cipher/tea/tea.h deleted file mode 100644 index 71d4e02f9..000000000 --- a/src/cipher/tea/tea.h +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************* -* TEA Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_TEA_H__ -#define BOTAN_TEA_H__ - -#include <botan/block_cipher.h> - -namespace Botan { - -/************************************************* -* TEA * -*************************************************/ -class BOTAN_DLL TEA : public BlockCipher - { - public: - void clear() throw() { K.clear(); } - std::string name() const { return "TEA"; } - BlockCipher* clone() const { return new TEA; } - TEA() : BlockCipher(8, 16) {} - private: - void enc(const byte[], byte[]) const; - void dec(const byte[], byte[]) const; - void key(const byte[], u32bit); - SecureBuffer<u32bit, 4> K; - }; - -} - -#endif |