Add Tiger cipher AlgorithmProvider()
parent
92163356db
commit
1f5d0d85cf
|
|
@ -21,9 +21,11 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
std::string SosemanukPolicy::AlgorithmProvider() const
|
std::string SosemanukPolicy::AlgorithmProvider() const
|
||||||
{
|
{
|
||||||
#if CRYPTOPP_SSE2_ASM_AVAILABLE
|
#ifndef CRYPTOPP_DISABLE_SOSEMANUK_ASM
|
||||||
|
# if CRYPTOPP_SSE2_ASM_AVAILABLE
|
||||||
if (HasSSE2())
|
if (HasSSE2())
|
||||||
return "SSE2";
|
return "SSE2";
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
return "C++";
|
return "C++";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ struct SosemanukInfo : public VariableKeyLength<16, 1, 32, 1, SimpleKeyingInterf
|
||||||
class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
|
class SosemanukPolicy : public AdditiveCipherConcretePolicy<word32, 20>, public SosemanukInfo
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
std::string AlgorithmProvider() const;
|
||||||
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
void CipherSetKey(const NameValuePairs ¶ms, const byte *key, size_t length);
|
||||||
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
|
||||||
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
|
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
|
||||||
|
|
@ -39,8 +40,6 @@ protected:
|
||||||
unsigned int GetOptimalBlockSize() const;
|
unsigned int GetOptimalBlockSize() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string AlgorithmProvider() const;
|
|
||||||
|
|
||||||
FixedSizeSecBlock<word32, 25*4> m_key;
|
FixedSizeSecBlock<word32, 25*4> m_key;
|
||||||
FixedSizeAlignedSecBlock<word32, 12> m_state;
|
FixedSizeAlignedSecBlock<word32, 12> m_state;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
11
tiger.cpp
11
tiger.cpp
|
|
@ -16,6 +16,17 @@
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
|
std::string Tiger::AlgorithmProvider() const
|
||||||
|
{
|
||||||
|
#ifndef CRYPTOPP_DISABLE_TIGER_ASM
|
||||||
|
# if CRYPTOPP_SSE2_ASM_AVAILABLE
|
||||||
|
if (HasSSE2())
|
||||||
|
return "SSE2";
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
return "C++";
|
||||||
|
}
|
||||||
|
|
||||||
void Tiger::InitState(HashWordType *state)
|
void Tiger::InitState(HashWordType *state)
|
||||||
{
|
{
|
||||||
state[0] = W64LIT(0x0123456789ABCDEF);
|
state[0] = W64LIT(0x0123456789ABCDEF);
|
||||||
|
|
|
||||||
4
tiger.h
4
tiger.h
|
|
@ -24,10 +24,12 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
class Tiger : public IteratedHashWithStaticTransform<word64, LittleEndian, 64, 24, Tiger>
|
class Tiger : public IteratedHashWithStaticTransform<word64, LittleEndian, 64, 24, Tiger>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Tiger";}
|
||||||
|
std::string AlgorithmProvider() const;
|
||||||
|
|
||||||
static void InitState(HashWordType *state);
|
static void InitState(HashWordType *state);
|
||||||
static void Transform(word64 *digest, const word64 *data);
|
static void Transform(word64 *digest, const word64 *data);
|
||||||
void TruncatedFinal(byte *hash, size_t size);
|
void TruncatedFinal(byte *hash, size_t size);
|
||||||
CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "Tiger";}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const word64 table[4*256+3];
|
static const word64 table[4*256+3];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue