diff options
Diffstat (limited to 'Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h')
-rw-r--r-- | Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h b/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h index 64f4b5f..7b4e124 100644 --- a/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h +++ b/Swiften/FileTransfer/IncrementalBytestreamHashCalculator.h @@ -4,30 +4,40 @@ * See Documentation/Licenses/BSD-simplified.txt for more information. */ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + #pragma once +#include <string> + #include <Swiften/Base/ByteArray.h> #include <Swiften/Base/SafeByteArray.h> +#include <boost/optional.hpp> namespace Swift { - -class MD5; -class SHA1; - -class IncrementalBytestreamHashCalculator { -public: - IncrementalBytestreamHashCalculator(bool doMD5, bool doSHA1); - ~IncrementalBytestreamHashCalculator(); - - void feedData(const ByteArray& data); - //void feedData(const SafeByteArray& data); - - std::string getSHA1String(); - std::string getMD5String(); - -private: - MD5* md5Hasher; - SHA1* sha1Hasher; -}; + class Hash; + class CryptoProvider; + + class IncrementalBytestreamHashCalculator { + public: + IncrementalBytestreamHashCalculator(bool doMD5, bool doSHA1, CryptoProvider* crypto); + ~IncrementalBytestreamHashCalculator(); + + void feedData(const ByteArray& data); + //void feedData(const SafeByteArray& data); + + std::string getSHA1String(); + std::string getMD5String(); + + private: + Hash* md5Hasher; + Hash* sha1Hasher; + boost::optional<std::string> md5Hash; + boost::optional<std::string> sha1Hash; + }; } |