1 /* 2 * Tiger 3 * (C) 1999-2007 Jack Lloyd 4 * 5 * Distributed under the terms of the Botan license 6 */ 7 8 #ifndef BOTAN_TIGER_H__ 9 #define BOTAN_TIGER_H__ 10 11 #include <botan/mdx_hash.h> 12 13 namespace Botan { 14 15 /** 16 * Tiger 17 */ 18 class BOTAN_DLL Tiger : public MDx_HashFunction 19 { 20 public: 21 std::string name() const; output_length()22 size_t output_length() const { return hash_len; } 23 clone()24 HashFunction* clone() const 25 { 26 return new Tiger(output_length(), passes); 27 } 28 29 void clear(); 30 31 /** 32 * @param out_size specifies the output length; can be 16, 20, or 24 33 * @param passes to make in the algorithm 34 */ 35 Tiger(size_t out_size = 24, size_t passes = 3); 36 private: 37 void compress_n(const byte[], size_t block); 38 void copy_out(byte[]); 39 40 static void pass(u64bit& A, u64bit& B, u64bit& C, 41 const MemoryRegion<u64bit>& M, 42 byte mul); 43 44 static const u64bit SBOX1[256]; 45 static const u64bit SBOX2[256]; 46 static const u64bit SBOX3[256]; 47 static const u64bit SBOX4[256]; 48 49 SecureVector<u64bit> X, digest; 50 const size_t hash_len, passes; 51 }; 52 53 } 54 55 #endif 56