diff --git a/sdk/storage/azure-storage-common/src/crypt.cpp b/sdk/storage/azure-storage-common/src/crypt.cpp index 9719f48a9..d81500443 100644 --- a/sdk/storage/azure-storage-common/src/crypt.cpp +++ b/sdk/storage/azure-storage-common/src/crypt.cpp @@ -151,10 +151,8 @@ namespace Azure { namespace Storage { std::vector Sha256(const std::vector& data) { - if (data.size() > std::numeric_limits::max()) - { - throw std::runtime_error("Data size is too big."); - } + AZURE_ASSERT_MSG(data.size() <= std::numeric_limits::max(), "Data size is too big."); + static AlgorithmProviderInstance AlgorithmProvider(AlgorithmType::Sha256); std::string context; @@ -202,10 +200,7 @@ namespace Azure { namespace Storage { const std::vector& data, const std::vector& key) { - if (data.size() > std::numeric_limits::max()) - { - throw std::runtime_error("Data size is too big."); - } + AZURE_ASSERT_MSG(data.size() <= std::numeric_limits::max(), "Data size is too big."); static AlgorithmProviderInstance AlgorithmProvider(AlgorithmType::HmacSha256);