/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Utils; namespace Aws { namespace signer { namespace Model { namespace HashAlgorithmMapper { static const int SHA1_HASH = HashingUtils::HashString("SHA1"); static const int SHA256_HASH = HashingUtils::HashString("SHA256"); HashAlgorithm GetHashAlgorithmForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == SHA1_HASH) { return HashAlgorithm::SHA1; } else if (hashCode == SHA256_HASH) { return HashAlgorithm::SHA256; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast(hashCode); } return HashAlgorithm::NOT_SET; } Aws::String GetNameForHashAlgorithm(HashAlgorithm enumValue) { switch(enumValue) { case HashAlgorithm::SHA1: return "SHA1"; case HashAlgorithm::SHA256: return "SHA256"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast(enumValue)); } return {}; } } } // namespace HashAlgorithmMapper } // namespace Model } // namespace signer } // namespace Aws