Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
789 B

  1. // adler32.h - written and placed in the public domain by Wei Dai
  2. //! \file
  3. //! \headerfile adler32.h
  4. //! \brief Class file for ADLER-32 checksum calculations
  5. #ifndef CRYPTOPP_ADLER32_H
  6. #define CRYPTOPP_ADLER32_H
  7. #include "cryptlib.h"
  8. NAMESPACE_BEGIN(CryptoPP)
  9. //! ADLER-32 checksum calculations
  10. class Adler32 : public HashTransformation
  11. {
  12. public:
  13. CRYPTOPP_CONSTANT(DIGESTSIZE = 4)
  14. Adler32() {Reset();}
  15. void Update(const byte *input, size_t length);
  16. void TruncatedFinal(byte *hash, size_t size);
  17. unsigned int DigestSize() const {return DIGESTSIZE;}
  18. static const char * StaticAlgorithmName() {return "Adler32";}
  19. std::string AlgorithmName() const {return StaticAlgorithmName();}
  20. private:
  21. void Reset() {m_s1 = 1; m_s2 = 0;}
  22. word16 m_s1, m_s2;
  23. };
  24. NAMESPACE_END
  25. #endif