1 #ifndef CRYPTOPP_PANAMA_H
2 #define CRYPTOPP_PANAMA_H
7 NAMESPACE_BEGIN(CryptoPP)
15 void Iterate(
size_t count,
const word32 *p=NULL, byte *output=NULL,
const byte *input=NULL, KeystreamOperation operation=WRITE_KEYSTREAM);
18 typedef word32 Stage[8];
19 CRYPTOPP_CONSTANT(STAGES = 32)
26 template <
class B = LittleEndian>
30 CRYPTOPP_CONSTANT(DIGESTSIZE = 32)
32 unsigned int DigestSize()
const {
return DIGESTSIZE;}
33 void TruncatedFinal(byte *hash,
size_t size);
34 static const char * StaticAlgorithmName() {
return B::ToEnum() == BIG_ENDIAN_ORDER ?
"Panama-BE" :
"Panama-LE";}
38 void HashEndianCorrectedBlock(
const word32 *data) {this->Iterate(1, data);}
39 size_t HashMultipleBlocks(
const word32 *input,
size_t length);
40 word32* StateBuf() {
return NULL;}
45 template <
class T_Hash,
class T_Info = T_Hash>
49 void UncheckedSetKey(
const byte *key,
unsigned int length,
const NameValuePairs ¶ms)
61 void Update(
const byte *input,
size_t length)
65 m_hash.Update(input, length);
72 m_hash.TruncatedFinal(digest, digestSize);
77 {
return m_hash.DigestSize();}
79 {
return m_hash.BlockSize();}
81 {
return m_hash.OptimalBlockSize();}
83 {
return m_hash.OptimalDataAlignment();}
88 m_hash.Update(m_key, m_key.size());
99 template <
class B = LittleEndian>
104 PanamaMAC(
const byte *key,
unsigned int length)
105 {this->
SetKey(key, length);}
113 static const char * StaticAlgorithmName() {
return B::ToEnum() == BIG_ENDIAN_ORDER ?
"Panama-BE" :
"Panama-LE";}
123 void CipherSetKey(
const NameValuePairs ¶ms,
const byte *key,
size_t length);
124 void OperateKeystream(KeystreamOperation operation, byte *output,
const byte *input,
size_t iterationCount);
125 bool CipherIsRandomAccess()
const {
return false;}
126 void CipherResynchronize(byte *keystreamBuffer,
const byte *iv,
size_t length);
127 #if CRYPTOPP_BOOL_X86 || CRYPTOPP_BOOL_X64
128 unsigned int GetAlignment()
const;
135 template <
class B = LittleEndian>
to be inherited by keyed algorithms with fixed key length
virtual void SetKey(const byte *key, size_t length, const NameValuePairs ¶ms=g_nullNameValuePairs)
set or reset the key of this object
void Update(const byte *input, size_t length)
process more input
unsigned int OptimalDataAlignment() const
returns how input should be aligned for optimal performance
unsigned int BlockSize() const
block size of underlying compression function, or 0 if not block based
void TruncatedFinal(byte *digest, size_t digestSize)
truncated version of Final()
void Assign(const T *t, size_type len)
set contents and size
MAC construction using a hermetic hash function.
unsigned int DigestSize() const
size of the hash/digest/MAC returned by Final()
unsigned int OptimalBlockSize() const
input to Update() should have length a multiple of this for optimal speed
Each class derived from this one defines two types, Encryption and Decryption, both of which implemen...
base class, do not use directly
void Restart()
discard the current state, and restart with a new message
interface for retrieving values given their names