1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- #ifndef cmCryptoHash_h
- #define cmCryptoHash_h
- #include "cmConfigure.h"
- #include <memory> // IWYU pragma: keep
- #include <stddef.h>
- #include <string>
- #include <vector>
- class cmCryptoHash
- {
- CM_DISABLE_COPY(cmCryptoHash)
- public:
- enum Algo
- {
- AlgoMD5,
- AlgoSHA1,
- AlgoSHA224,
- AlgoSHA256,
- AlgoSHA384,
- AlgoSHA512,
- AlgoSHA3_224,
- AlgoSHA3_256,
- AlgoSHA3_384,
- AlgoSHA3_512
- };
- cmCryptoHash(Algo algo);
- ~cmCryptoHash();
-
-
-
-
-
-
- static std::unique_ptr<cmCryptoHash> New(const char* algo);
-
-
-
-
- static bool IntFromHexDigit(char input, char& output);
-
- static std::string ByteHashToString(const std::vector<unsigned char>& hash);
-
-
- std::vector<unsigned char> ByteHashString(const std::string& input);
-
-
-
-
- std::vector<unsigned char> ByteHashFile(const std::string& file);
-
-
- std::string HashString(const std::string& input);
-
-
-
-
- std::string HashFile(const std::string& file);
- void Initialize();
- void Append(void const*, size_t);
- void Append(std::string const& str);
- std::vector<unsigned char> Finalize();
- std::string FinalizeHex();
- private:
- unsigned int Id;
- struct rhash_context* CTX;
- };
- #endif
|