From e2f2ace688167fe71d574b0c1b3305eacaeb9077 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Wed, 7 Sep 2016 06:39:52 -0400 Subject: [PATCH] Add constexpr-ness to ChaCha StaticAlgorithmName member function --- chacha.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chacha.h b/chacha.h index 28b8c7af..f62606b7 100644 --- a/chacha.h +++ b/chacha.h @@ -19,7 +19,9 @@ NAMESPACE_BEGIN(CryptoPP) template struct ChaCha_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>, public FixedRounds { - static const char *StaticAlgorithmName() {static const std::string name = "ChaCha" + IntToString(R); return name.c_str();} + CRYPTOPP_CONSTEXPR static const char *StaticAlgorithmName() { + return (R==8?"ChaCha8":(R==12?"ChaCha12":(R==20?"ChaCha20":"ChaCha"))); + } }; //! \class ChaCha_Policy