Botan  1.11.15
src/lib/hash/tiger/tiger.h
Go to the documentation of this file.
00001 /*
00002 * Tiger
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_TIGER_H__
00009 #define BOTAN_TIGER_H__
00010 
00011 #include <botan/mdx_hash.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * Tiger
00017 */
00018 class BOTAN_DLL Tiger : public MDx_HashFunction
00019    {
00020    public:
00021       std::string name() const;
00022       size_t output_length() const { return hash_len; }
00023 
00024       HashFunction* clone() const
00025          {
00026          return new Tiger(output_length(), passes);
00027          }
00028 
00029       void clear();
00030 
00031       /**
00032       * @param out_size specifies the output length; can be 16, 20, or 24
00033       * @param passes to make in the algorithm
00034       */
00035       Tiger(size_t out_size = 24, size_t passes = 3);
00036    private:
00037       void compress_n(const byte[], size_t block);
00038       void copy_out(byte[]);
00039 
00040       static void pass(u64bit& A, u64bit& B, u64bit& C,
00041                        const secure_vector<u64bit>& M,
00042                        byte mul);
00043 
00044       static const u64bit SBOX1[256];
00045       static const u64bit SBOX2[256];
00046       static const u64bit SBOX3[256];
00047       static const u64bit SBOX4[256];
00048 
00049       secure_vector<u64bit> X, digest;
00050       const size_t hash_len, passes;
00051    };
00052 
00053 }
00054 
00055 #endif