tiger.h 2.2 KB

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