Add constexpr-ness to ChaCha StaticAlgorithmName member function

pull/131/merge
Jeffrey Walton 2016-09-07 06:39:52 -04:00
parent c1556295e6
commit e2f2ace688
1 changed files with 3 additions and 1 deletions

View File

@ -19,7 +19,9 @@ NAMESPACE_BEGIN(CryptoPP)
template <unsigned int R>
struct ChaCha_Info : public VariableKeyLength<32, 16, 32, 16, SimpleKeyingInterface::UNIQUE_IV, 8>, public FixedRounds<R>
{
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