Security Scol plugin
hc128.h
Go to the documentation of this file.
1// hc128.h - written and placed in the public domain by Jeffrey Walton
2// based on public domain code by Hongjun Wu.
3//
4// The reference materials and source files are available at
5// The eSTREAM Project, http://www.ecrypt.eu.org/stream/e2-hc128.html.
6
13
14#ifndef CRYPTOPP_HC128_H
15#define CRYPTOPP_HC128_H
16
17#include "strciphr.h"
18#include "secblock.h"
19
20NAMESPACE_BEGIN(CryptoPP)
21
22
24struct HC128Info : public FixedKeyLength<16, SimpleKeyingInterface::UNIQUE_IV, 16>
25{
26 CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() { return "HC-128"; }
27};
28
31class HC128Policy : public AdditiveCipherConcretePolicy<word32, 16>, public HC128Info
32{
33protected:
34 void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length);
35 void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount);
36 void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length);
37 bool CanOperateKeystream() const { return true; }
38 bool CipherIsRandomAccess() const { return false; }
39
40 void GenerateKeystream(word32* keystream);
41 void SetupUpdate();
42
43private:
48 word32 m_T[1024];
49 word32 m_ctr;
50};
51
64
65NAMESPACE_END
66
67#endif // CRYPTOPP_HC128_H
Inherited by keyed algorithms with fixed key length.
Definition seckey.h:125
Fixed size stack-based SecBlock.
Definition secblock.h:1246
HC-128 stream cipher implementation.
Definition hc128.h:32
void OperateKeystream(KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)
Operates the keystream.
Definition hc128.cpp:201
void CipherSetKey(const NameValuePairs &params, const byte *key, size_t length)
Key the cipher.
Definition hc128.cpp:192
bool CanOperateKeystream() const
Flag indicating.
Definition hc128.h:37
void CipherResynchronize(byte *keystreamBuffer, const byte *iv, size_t length)
Resynchronize the cipher.
Definition hc128.cpp:242
bool CipherIsRandomAccess() const
Flag indicating random access.
Definition hc128.h:38
Interface for retrieving values given their names.
Definition cryptlib.h:322
Interface for algorithms that take byte strings as keys.
Definition cryptlib.h:642
SymmetricCipher implementation.
Definition strciphr.h:684
unsigned int word32
32-bit unsigned datatype
Definition config_int.h:62
Classes and functions for secure memory allocations.
Classes for implementing stream ciphers.
KeystreamOperation
Keystream operation flags.
Definition strciphr.h:88
Base class for additive stream ciphers.
Definition strciphr.h:202
HC-128 stream cipher.
Definition hc128.h:60
HC-128 stream cipher information.
Definition hc128.h:25
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher.
Definition seckey.h:414