Counter Strike : Global Offensive Source Code
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.

63 lines
2.4 KiB

  1. #ifndef CRYPTOPP_SHA_H
  2. #define CRYPTOPP_SHA_H
  3. #include "iterhash.h"
  4. NAMESPACE_BEGIN(CryptoPP)
  5. /// <a href="http://www.weidai.com/scan-mirror/md.html#SHA-1">SHA-1</a>
  6. class CRYPTOPP_DLL SHA1 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 20, SHA1>
  7. {
  8. public:
  9. static void CRYPTOPP_API InitState(HashWordType *state);
  10. static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
  11. static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-1";}
  12. };
  13. typedef SHA1 SHA; // for backwards compatibility
  14. //! implements the SHA-256 standard
  15. class CRYPTOPP_DLL SHA256 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA256, 32, true>
  16. {
  17. public:
  18. #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
  19. size_t HashMultipleBlocks(const word32 *input, size_t length);
  20. #endif
  21. static void CRYPTOPP_API InitState(HashWordType *state);
  22. static void CRYPTOPP_API Transform(word32 *digest, const word32 *data);
  23. static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-256";}
  24. };
  25. //! implements the SHA-224 standard
  26. class CRYPTOPP_DLL SHA224 : public IteratedHashWithStaticTransform<word32, BigEndian, 64, 32, SHA224, 28, true>
  27. {
  28. public:
  29. #if defined(CRYPTOPP_X86_ASM_AVAILABLE) || defined(CRYPTOPP_X64_MASM_AVAILABLE)
  30. size_t HashMultipleBlocks(const word32 *input, size_t length);
  31. #endif
  32. static void CRYPTOPP_API InitState(HashWordType *state);
  33. static void CRYPTOPP_API Transform(word32 *digest, const word32 *data) {SHA256::Transform(digest, data);}
  34. static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-224";}
  35. };
  36. //! implements the SHA-512 standard
  37. class CRYPTOPP_DLL SHA512 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA512, 64, CRYPTOPP_BOOL_X86>
  38. {
  39. public:
  40. static void CRYPTOPP_API InitState(HashWordType *state);
  41. static void CRYPTOPP_API Transform(word64 *digest, const word64 *data);
  42. static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-512";}
  43. };
  44. //! implements the SHA-384 standard
  45. class CRYPTOPP_DLL SHA384 : public IteratedHashWithStaticTransform<word64, BigEndian, 128, 64, SHA384, 48, CRYPTOPP_BOOL_X86>
  46. {
  47. public:
  48. static void CRYPTOPP_API InitState(HashWordType *state);
  49. static void CRYPTOPP_API Transform(word64 *digest, const word64 *data) {SHA512::Transform(digest, data);}
  50. static const char * CRYPTOPP_API StaticAlgorithmName() {return "SHA-384";}
  51. };
  52. NAMESPACE_END
  53. #endif