Fabcoin Core  0.16.2
P2P Digital Currency
arc4.h
Go to the documentation of this file.
1 // arc4.h - written and placed in the public domain by Wei Dai
2 
5 
6 #ifndef CRYPTOPP_ARC4_H
7 #define CRYPTOPP_ARC4_H
8 
9 #include "cryptlib.h"
10 #include "strciphr.h"
11 #include "secblock.h"
12 #include "smartptr.h"
13 
15 
16 namespace Weak1 {
17 
23 {
24 public:
25  ~ARC4_Base();
26 
27  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "ARC4";}
28 
29  void GenerateBlock(byte *output, size_t size);
30  void DiscardBytes(size_t n);
31 
32  void ProcessData(byte *outString, const byte *inString, size_t length);
33 
34  bool IsRandomAccess() const {return false;}
35  bool IsSelfInverting() const {return true;}
36  bool IsForwardTransformation() const {return true;}
37 
40 
41 protected:
42  void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params);
43  virtual unsigned int GetDefaultDiscardBytes() const {return 0;}
44 
46  byte m_x, m_y;
47 };
48 
54 
60 {
61 public:
62  CRYPTOPP_STATIC_CONSTEXPR const char* StaticAlgorithmName() {return "MARC4";}
63 
66 
67 protected:
68  unsigned int GetDefaultDiscardBytes() const {return 256;}
69 };
70 
76 
77 }
78 #if CRYPTOPP_ENABLE_NAMESPACE_WEAK >= 1
79 namespace Weak {using namespace Weak1;} // import Weak1 into CryptoPP::Weak
80 #else
81 using namespace Weak1; // import Weak1 into CryptoPP with warning
82 #ifdef __GNUC__
83 #warning "You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning."
84 #else
85 #pragma message("You may be using a weak algorithm that has been retained for backwards compatibility. Please '#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1' before including this .h file and prepend the class name with 'Weak::' to remove this warning.")
86 #endif
87 #endif
88 
90 
91 #endif
#define DOCUMENTED_TYPEDEF(x, y)
Definition: config.h:202
uint8_t byte
Definition: Common.h:57
byte m_y
Definition: arc4.h:46
virtual void ProcessData(byte *outString, const byte *inString, size_t length)=0
Encrypt or decrypt an array of bytes.
#define CRYPTOPP_STATIC_CONSTEXPR
Definition: config.h:892
virtual void GenerateBlock(byte *output, size_t size)
Generate random array of bytes.
Definition: cryptlib.cpp:326
#define NAMESPACE_BEGIN(x)
Definition: config.h:200
Abstract base classes that provide a uniform interface to this library.
virtual void DiscardBytes(size_t n)
Generate and discard n bytes.
Definition: cryptlib.cpp:339
Classes for automatic resource management.
Interface for random number generators.
Definition: cryptlib.h:1188
bool IsForwardTransformation() const
Determines if the cipher is being operated in its forward direction.
Definition: arc4.h:36
SymmetricCipherFinal< MARC4_Base > Encryption
Definition: arc4.h:64
unsigned int GetDefaultDiscardBytes() const
Definition: arc4.h:68
Classes and functions for secure memory allocations.
SymmetricCipherFinal< ARC4_Base > Decryption
Definition: arc4.h:39
MARC4 base class.
Definition: arc4.h:59
FixedSizeSecBlock< byte, 256 > m_state
Definition: arc4.h:45
SymmetricCipherFinal< ARC4_Base > Encryption
Definition: arc4.h:38
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: arc4.h:62
Interface for one direction (encryption or decryption) of a stream cipher or cipher mode...
Definition: cryptlib.h:1103
Alleged RC4.
Inherited by keyed algorithms with variable key length.
Definition: seckey.h:169
#define CRYPTOPP_NO_VTABLE
Definition: config.h:369
Classes for implementing stream ciphers.
Provides Encryption and Decryption typedefs used by derived classes to implement a symmetric cipher...
Definition: seckey.h:424
SymmetricCipherFinal< MARC4_Base > Decryption
Definition: arc4.h:65
virtual unsigned int GetDefaultDiscardBytes() const
Definition: arc4.h:43
uint8_t const size_t const size
Definition: sha3.h:20
CRYPTOPP_STATIC_CONSTEXPR const char * StaticAlgorithmName()
Definition: arc4.h:27
bool IsSelfInverting() const
Determines whether the cipher is self-inverting.
Definition: arc4.h:35
virtual void UncheckedSetKey(const byte *key, unsigned int length, const NameValuePairs &params)=0
Sets the key for this object without performing parameter validation.
#define NAMESPACE_END
Definition: config.h:201
SymmetricCipher implementation.
Definition: strciphr.h:584
Modified Alleged RC4.
ARC4 base class.
Definition: arc4.h:22
Definition: arc4.cpp:14
Definition: panama.cpp:423
bool IsRandomAccess() const
Determines whether the cipher supports random access.
Definition: arc4.h:34
Interface for retrieving values given their names.
Definition: cryptlib.h:279