diff options
author | lloyd <[email protected]> | 2008-09-28 17:01:15 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-28 17:01:15 +0000 |
commit | b677f899b4175dfb1e8910e219ade760cd716d95 (patch) | |
tree | 54a655dcd5c726537b549a68b1556f3c89fad513 /include | |
parent | 722c92122487850e974a14b5e4b90be4b952a6da (diff) |
Modularize hashes and checksums
Diffstat (limited to 'include')
-rw-r--r-- | include/crc24.h | 32 | ||||
-rw-r--r-- | include/crc32.h | 32 | ||||
-rw-r--r-- | include/fork256.h | 33 | ||||
-rw-r--r-- | include/has160.h | 33 | ||||
-rw-r--r-- | include/md2.h | 35 | ||||
-rw-r--r-- | include/md4.h | 33 | ||||
-rw-r--r-- | include/md5.h | 33 | ||||
-rw-r--r-- | include/rmd128.h | 33 | ||||
-rw-r--r-- | include/rmd160.h | 33 | ||||
-rw-r--r-- | include/sha160.h | 33 | ||||
-rw-r--r-- | include/sha256.h | 33 | ||||
-rw-r--r-- | include/sha_64.h | 55 | ||||
-rw-r--r-- | include/tiger.h | 42 | ||||
-rw-r--r-- | include/whrlpool.h | 40 |
14 files changed, 0 insertions, 500 deletions
diff --git a/include/crc24.h b/include/crc24.h deleted file mode 100644 index 919f860ce..000000000 --- a/include/crc24.h +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************* -* CRC24 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_CRC24_H__ -#define BOTAN_CRC24_H__ - -#include <botan/base.h> - -namespace Botan { - -/************************************************* -* CRC24 * -*************************************************/ -class BOTAN_DLL CRC24 : public HashFunction - { - public: - void clear() throw() { crc = 0xB704CE; } - std::string name() const { return "CRC24"; } - HashFunction* clone() const { return new CRC24; } - CRC24() : HashFunction(3) { clear(); } - ~CRC24() { clear(); } - private: - void add_data(const byte[], u32bit); - void final_result(byte[]); - u32bit crc; - }; - -} - -#endif diff --git a/include/crc32.h b/include/crc32.h deleted file mode 100644 index 51939c6e1..000000000 --- a/include/crc32.h +++ /dev/null @@ -1,32 +0,0 @@ -/************************************************* -* CRC32 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_CRC32_H__ -#define BOTAN_CRC32_H__ - -#include <botan/base.h> - -namespace Botan { - -/************************************************* -* CRC32 * -*************************************************/ -class BOTAN_DLL CRC32 : public HashFunction - { - public: - void clear() throw() { crc = 0xFFFFFFFF; } - std::string name() const { return "CRC32"; } - HashFunction* clone() const { return new CRC32; } - CRC32() : HashFunction(4) { clear(); } - ~CRC32() { clear(); } - private: - void add_data(const byte[], u32bit); - void final_result(byte[]); - u32bit crc; - }; - -} - -#endif diff --git a/include/fork256.h b/include/fork256.h deleted file mode 100644 index 8ad9c1f8d..000000000 --- a/include/fork256.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* FORK-256 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_FORK_256_H__ -#define BOTAN_FORK_256_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* FORK-256 * -*************************************************/ -class BOTAN_DLL FORK_256 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "FORK-256"; } - HashFunction* clone() const { return new FORK_256; } - FORK_256() : MDx_HashFunction(32, 64, true, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 8> digest; - SecureBuffer<u32bit, 16> M; - }; - -} - -#endif diff --git a/include/has160.h b/include/has160.h deleted file mode 100644 index 9e35bfdca..000000000 --- a/include/has160.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* HAS-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_HAS_160_H__ -#define BOTAN_HAS_160_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* HAS-160 * -*************************************************/ -class BOTAN_DLL HAS_160 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "HAS-160"; } - HashFunction* clone() const { return new HAS_160; } - HAS_160() : MDx_HashFunction(20, 64, false, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 20> X; - SecureBuffer<u32bit, 5> digest; - }; - -} - -#endif diff --git a/include/md2.h b/include/md2.h deleted file mode 100644 index 2c53d1cf0..000000000 --- a/include/md2.h +++ /dev/null @@ -1,35 +0,0 @@ -/************************************************* -* MD2 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_MD2_H__ -#define BOTAN_MD2_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* MD2 * -*************************************************/ -class BOTAN_DLL MD2 : public HashFunction - { - public: - void clear() throw(); - std::string name() const { return "MD2"; } - HashFunction* clone() const { return new MD2; } - MD2() : HashFunction(16, 16) { clear(); } - private: - void add_data(const byte[], u32bit); - void hash(const byte[]); - void final_result(byte[]); - - SecureBuffer<byte, 48> X; - SecureBuffer<byte, 16> checksum, buffer; - u32bit position; - }; - -} - -#endif diff --git a/include/md4.h b/include/md4.h deleted file mode 100644 index 4bb5e3903..000000000 --- a/include/md4.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* MD4 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_MD4_H__ -#define BOTAN_MD4_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* MD4 * -*************************************************/ -class BOTAN_DLL MD4 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "MD4"; } - HashFunction* clone() const { return new MD4; } - MD4() : MDx_HashFunction(16, 64, false, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 48> M; - SecureBuffer<u32bit, 4> digest; - }; - -} - -#endif diff --git a/include/md5.h b/include/md5.h deleted file mode 100644 index 9634c526d..000000000 --- a/include/md5.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* MD5 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_MD5_H__ -#define BOTAN_MD5_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* MD5 * -*************************************************/ -class BOTAN_DLL MD5 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "MD5"; } - HashFunction* clone() const { return new MD5; } - MD5() : MDx_HashFunction(16, 64, false, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 16> M; - SecureBuffer<u32bit, 4> digest; - }; - -} - -#endif diff --git a/include/rmd128.h b/include/rmd128.h deleted file mode 100644 index 2cb98e516..000000000 --- a/include/rmd128.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* RIPEMD-128 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_RIPEMD_128_H__ -#define BOTAN_RIPEMD_128_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* RIPEMD-128 * -*************************************************/ -class BOTAN_DLL RIPEMD_128 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "RIPEMD-128"; } - HashFunction* clone() const { return new RIPEMD_128; } - RIPEMD_128() : MDx_HashFunction(16, 64, false, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 16> M; - SecureBuffer<u32bit, 4> digest; - }; - -} - -#endif diff --git a/include/rmd160.h b/include/rmd160.h deleted file mode 100644 index 0544f21cc..000000000 --- a/include/rmd160.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* RIPEMD-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_RIPEMD_160_H__ -#define BOTAN_RIPEMD_160_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* RIPEMD-160 * -*************************************************/ -class BOTAN_DLL RIPEMD_160 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "RIPEMD-160"; } - HashFunction* clone() const { return new RIPEMD_160; } - RIPEMD_160() : MDx_HashFunction(20, 64, false, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 16> M; - SecureBuffer<u32bit, 5> digest; - }; - -} - -#endif diff --git a/include/sha160.h b/include/sha160.h deleted file mode 100644 index 022ab9514..000000000 --- a/include/sha160.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* SHA-160 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_SHA_160_H__ -#define BOTAN_SHA_160_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* SHA-160 * -*************************************************/ -class BOTAN_DLL SHA_160 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "SHA-160"; } - HashFunction* clone() const { return new SHA_160; } - SHA_160(); - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 5> digest; - SecureVector<u32bit> W; - }; - -} - -#endif diff --git a/include/sha256.h b/include/sha256.h deleted file mode 100644 index cdbe02822..000000000 --- a/include/sha256.h +++ /dev/null @@ -1,33 +0,0 @@ -/************************************************* -* SHA-256 Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_SHA_256_H__ -#define BOTAN_SHA_256_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* SHA-256 * -*************************************************/ -class BOTAN_DLL SHA_256 : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "SHA-256"; } - HashFunction* clone() const { return new SHA_256; } - SHA_256() : MDx_HashFunction(32, 64, true, true) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u32bit, 64> W; - SecureBuffer<u32bit, 8> digest; - }; - -} - -#endif diff --git a/include/sha_64.h b/include/sha_64.h deleted file mode 100644 index e590d088d..000000000 --- a/include/sha_64.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************* -* SHA-{384,512} Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_SHA_64BIT_H__ -#define BOTAN_SHA_64BIT_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* SHA-{384,512} Base * -*************************************************/ -class BOTAN_DLL SHA_64_BASE : public MDx_HashFunction - { - protected: - void clear() throw(); - SHA_64_BASE(u32bit out) : MDx_HashFunction(out, 128, true, true, 16) {} - SecureBuffer<u64bit, 8> digest; - private: - void hash(const byte[]); - void copy_out(byte[]); - - SecureBuffer<u64bit, 80> W; - }; - -/************************************************* -* SHA-384 * -*************************************************/ -class BOTAN_DLL SHA_384 : public SHA_64_BASE - { - public: - void clear() throw(); - std::string name() const { return "SHA-384"; } - HashFunction* clone() const { return new SHA_384; } - SHA_384() : SHA_64_BASE(48) { clear(); } - }; - -/************************************************* -* SHA-512 * -*************************************************/ -class BOTAN_DLL SHA_512 : public SHA_64_BASE - { - public: - void clear() throw(); - std::string name() const { return "SHA-512"; } - HashFunction* clone() const { return new SHA_512; } - SHA_512() : SHA_64_BASE(64) { clear(); } - }; - -} - -#endif diff --git a/include/tiger.h b/include/tiger.h deleted file mode 100644 index 4c95fa784..000000000 --- a/include/tiger.h +++ /dev/null @@ -1,42 +0,0 @@ -/************************************************* -* Tiger Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_TIGER_H__ -#define BOTAN_TIGER_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* Tiger * -*************************************************/ -class BOTAN_DLL Tiger : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const; - HashFunction* clone() const { return new Tiger(OUTPUT_LENGTH); } - Tiger(u32bit = 24, u32bit = 3); - private: - void hash(const byte[]); - void copy_out(byte[]); - - static void pass(u64bit&, u64bit&, u64bit&, u64bit[8], byte); - static void mix(u64bit[8]); - - static const u64bit SBOX1[256]; - static const u64bit SBOX2[256]; - static const u64bit SBOX3[256]; - static const u64bit SBOX4[256]; - - SecureBuffer<u64bit, 8> X; - SecureBuffer<u64bit, 3> digest; - const u32bit PASS; - }; - -} - -#endif diff --git a/include/whrlpool.h b/include/whrlpool.h deleted file mode 100644 index 22f747520..000000000 --- a/include/whrlpool.h +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************* -* Whirlpool Header File * -* (C) 1999-2007 Jack Lloyd * -*************************************************/ - -#ifndef BOTAN_WHIRLPOOL_H__ -#define BOTAN_WHIRLPOOL_H__ - -#include <botan/mdx_hash.h> - -namespace Botan { - -/************************************************* -* Whirlpool * -*************************************************/ -class BOTAN_DLL Whirlpool : public MDx_HashFunction - { - public: - void clear() throw(); - std::string name() const { return "Whirlpool"; } - HashFunction* clone() const { return new Whirlpool; } - Whirlpool() : MDx_HashFunction(64, 64, true, true, 32) { clear(); } - private: - void hash(const byte[]); - void copy_out(byte[]); - - static const u64bit C0[256]; - static const u64bit C1[256]; - static const u64bit C2[256]; - static const u64bit C3[256]; - static const u64bit C4[256]; - static const u64bit C5[256]; - static const u64bit C6[256]; - static const u64bit C7[256]; - SecureBuffer<u64bit, 8> M, digest; - }; - -} - -#endif |