summaryrefslogtreecommitdiff
path: root/cpp/src/IceUtil/SHA1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceUtil/SHA1.cpp')
-rw-r--r--cpp/src/IceUtil/SHA1.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/cpp/src/IceUtil/SHA1.cpp b/cpp/src/IceUtil/SHA1.cpp
index eda08e35e38..31a5e459fad 100644
--- a/cpp/src/IceUtil/SHA1.cpp
+++ b/cpp/src/IceUtil/SHA1.cpp
@@ -102,18 +102,15 @@ void
IceUtil::sha1(const unsigned char* data, size_t length, vector<unsigned char>& md)
{
#if defined(ICE_OS_WINRT)
- auto dataA = ref new Platform::Array<unsigned char>(const_cast<unsigned char*>(&data[0]),
- static_cast<unsigned int>(data.size()));
+ auto dataA = ref new Platform::Array<unsigned char>(const_cast<unsigned char*>(data), length);
auto hasher = Windows::Security::Cryptography::Core::HashAlgorithmProvider::OpenAlgorithm("SHA1");
auto hashed = hasher->HashData(Windows::Security::Cryptography::CryptographicBuffer::CreateFromByteArray(dataA));
auto reader = ::Windows::Storage::Streams::DataReader::FromBuffer(hashed);
md.resize(reader->UnconsumedBufferLength);
if(!md.empty())
{
- reader->ReadBytes(::Platform::ArrayReference<unsigned char>(&result[0],
- static_cast<unsigned int>(result.size())));
+ reader->ReadBytes(::Platform::ArrayReference<unsigned char>(&md[0], static_cast<unsigned int>(md.size())));
}
- return md;
#elif defined(_WIN32)
SHA1 hasher;
hasher.update(data, length);