Line | Count | Source |
1 | | // tiger.h - originally written and placed in the public domain by Wei Dai |
2 | | |
3 | | /// \file tiger.h |
4 | | /// \brief Classes for the Tiger message digest |
5 | | /// \details Crypto++ provides the original Tiger hash that was |
6 | | /// submitted to the NESSIE project. The implementation is different |
7 | | /// from the revised Tiger2 hash. |
8 | | /// \sa <a href="https://www.cryptopp.com/wiki/Tiger">Tiger</a> and |
9 | | /// <a href="http://www.cs.technion.ac.il/~biham/Reports/Tiger/">Tiger: |
10 | | /// A Fast New Cryptographic Hash Function</a> |
11 | | /// \since Crypto++ 2.1 |
12 | | |
13 | | #ifndef CRYPTOPP_TIGER_H |
14 | | #define CRYPTOPP_TIGER_H |
15 | | |
16 | | #include "config.h" |
17 | | #include "iterhash.h" |
18 | | |
19 | | // Clang 3.3 integrated assembler crash on Linux. Clang 3.4 due to compiler |
20 | | // error with .intel_syntax, http://llvm.org/bugs/show_bug.cgi?id=24232 |
21 | | #if CRYPTOPP_BOOL_X32 || defined(CRYPTOPP_DISABLE_MIXED_ASM) |
22 | | # define CRYPTOPP_DISABLE_TIGER_ASM 1 |
23 | | #endif |
24 | | |
25 | | NAMESPACE_BEGIN(CryptoPP) |
26 | | |
27 | | /// \brief Tiger message digest |
28 | | /// \details Crypto++ provides the original Tiger hash that was |
29 | | /// submitted to the NESSIE project. The implementation is different |
30 | | /// from the revised Tiger2 hash. |
31 | | /// \sa <a href="https://www.cryptopp.com/wiki/Tiger">Tiger</a> and |
32 | | /// <a href="http://www.cs.technion.ac.il/~biham/Reports/Tiger/">Tiger: |
33 | | /// A Fast New Cryptographic Hash Function</a> |
34 | | /// \since Crypto++ 2.1 |
35 | | class Tiger : public IteratedHashWithStaticTransform<word64, LittleEndian, 64, 24, Tiger> |
36 | | { |
37 | | public: |
38 | 5 | CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Tiger";} |
39 | | std::string AlgorithmProvider() const; |
40 | | |
41 | | /// \brief Initialize state array |
42 | | /// \param state the state of the hash |
43 | | static void InitState(HashWordType *state); |
44 | | /// \brief Operate the hash |
45 | | /// \param digest the state of the hash |
46 | | /// \param data the data to be digested |
47 | | static void Transform(word64 *digest, const word64 *data); |
48 | | /// \brief Computes the hash of the current message |
49 | | /// \param digest a pointer to the buffer to receive the hash |
50 | | /// \param digestSize the size of the truncated digest, in bytes |
51 | | /// \details TruncatedFinal() calls Final() and then copies digestSize bytes to digest. |
52 | | /// The hash is restarted the hash for the next message. |
53 | | void TruncatedFinal(byte *digest, size_t digestSize); |
54 | | |
55 | | protected: |
56 | | static const word64 table[4*256+3]; |
57 | | }; |
58 | | |
59 | | NAMESPACE_END |
60 | | |
61 | | #endif |