diff options
Diffstat (limited to 'Swiften/StringCodecs/SHA1.cpp')
-rw-r--r-- | Swiften/StringCodecs/SHA1.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/Swiften/StringCodecs/SHA1.cpp b/Swiften/StringCodecs/SHA1.cpp index 5001fb2..e4081f4 100644 --- a/Swiften/StringCodecs/SHA1.cpp +++ b/Swiften/StringCodecs/SHA1.cpp @@ -197,11 +197,12 @@ std::vector<unsigned char> SHA1::getHash() const { return digest; } -ByteArray SHA1::getHash(const ByteArray& input) { +template<typename Container> +ByteArray SHA1::getHashInternal(const Container& input) { CTX context; Init(&context); - std::vector<unsigned char> inputCopy(input); + Container inputCopy(input); Update(&context, (boost::uint8_t*) vecptr(inputCopy), inputCopy.size()); ByteArray digest; @@ -211,4 +212,13 @@ ByteArray SHA1::getHash(const ByteArray& input) { return digest; } +ByteArray SHA1::getHash(const ByteArray& input) { + return getHashInternal(input); +} + +ByteArray SHA1::getHash(const SafeByteArray& input) { + return getHashInternal(input); +} + + } |