6#ifndef CRYPTOPP_PANAMA_H
7#define CRYPTOPP_PANAMA_H
19#define CRYPTOPP_DISABLE_PANAMA_ASM 1
29 std::string AlgorithmProvider()
const;
35 CRYPTOPP_CONSTANT(STAGES = 32);
43template <
class B = LittleEndian>
44class PanamaHash :
protected Panama<B>,
public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> >
47 CRYPTOPP_CONSTANT(DIGESTSIZE = 32);
48 virtual ~PanamaHash() {}
49 PanamaHash() {Panama<B>::Reset();}
56 void Init() {Panama<B>::Reset();}
57 void HashEndianCorrectedBlock(
const word32 *data) {this->Iterate(1, data);}
58 size_t HashMultipleBlocks(
const word32 *input,
size_t length);
59 word32* StateBuf() {
return NULLPTR;}
61 FixedSizeSecBlock<word32, 8> m_buf;
66template <
class T_Hash,
class T_Info = T_Hash>
70 void UncheckedSetKey(
const byte *key,
unsigned int length,
const NameValuePairs ¶ms)
72 CRYPTOPP_UNUSED(params);
74 m_key.Assign(key, length);
84 void Update(
const byte *input,
size_t length)
88 m_hash.Update(input, length);
91 void TruncatedFinal(
byte *digest,
size_t digestSize)
95 m_hash.TruncatedFinal(digest, digestSize);
99 unsigned int DigestSize()
const
100 {
return m_hash.DigestSize();}
101 unsigned int BlockSize()
const
102 {
return m_hash.BlockSize();}
103 unsigned int OptimalBlockSize()
const
104 {
return m_hash.OptimalBlockSize();}
105 unsigned int OptimalDataAlignment()
const
106 {
return m_hash.OptimalDataAlignment();}
111 m_hash.Update(m_key, m_key.size());
122template <
class B = LittleEndian>
127 PanamaMAC(
const byte *key,
unsigned int length)
128 {this->SetKey(key, length);}
136 CRYPTOPP_STATIC_CONSTEXPR
const char* StaticAlgorithmName() {
return B::ToEnum() ==
BIG_ENDIAN_ORDER ?
"Panama-BE" :
"Panama-LE";}
148 void CipherSetKey(
const NameValuePairs ¶ms,
const byte *key,
size_t length);
149 void OperateKeystream(
KeystreamOperation operation,
byte *output,
const byte *input,
size_t iterationCount);
151 void CipherResynchronize(
byte *keystreamBuffer,
const byte *iv,
size_t length);
160template <
class B = LittleEndian>
164 typedef Encryption Decryption;
Base class for additive stream ciphers with SymmetricCipher interface.
static std::string StaticAlgorithmName()
Inherited by keyed algorithms with fixed key length.
Fixed size stack-based SecBlock with 16-byte alignment.
Fixed size stack-based SecBlock.
MAC construction using a hermetic hash function.
Interface for retrieving values given their names.
Panama stream cipher operation.
SymmetricCipher implementation.
void TruncatedFinal(byte *hash, size_t size)
Computes the hash of the current message.
std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
unsigned int DigestSize() const
Provides the digest size of the hash.
unsigned int word32
32-bit unsigned datatype
@ BIG_ENDIAN_ORDER
byte order is big-endian
Base classes for iterated hashes.
Crypto++ library namespace.
Namespace containing weak and wounded algorithms.
Classes and functions for secure memory allocations.
Classes for implementing stream ciphers.
KeystreamOperation
Keystream operation flags.
@ WRITE_KEYSTREAM
Write the keystream to the output buffer, input is NULL.
virtual std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
virtual bool CipherIsRandomAccess() const =0
Flag indicating random access.
Base class for additive stream ciphers.
unsigned int GetAlignment() const
Panama stream cipher information.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher.