- Main Page
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ARC4_Base Class Reference

`#include <arc4.h>`

Inheritance diagram for ARC4_Base:

List of all members.

## Detailed Description

_

Definition at line 9 of file arc4.h.

## Public Types
typedef SymmetricCipherFinal< ARC4_Base > | Encryption
| implements the SymmetricCipher interface
typedef SymmetricCipherFinal< ARC4_Base > | Decryption
| implements the SymmetricCipher interface
enum |
enum |
## Public Member Functions
| ~ARC4_Base ()
byte | GenerateByte ()
| generate new random byte and return it
void | DiscardBytes (size_t n)
| generate and discard n bytes
void | ProcessData (byte *outString, const byte *inString, size_t length)
| encrypt or decrypt an array of bytes of specified length
bool | IsRandomAccess () const
| returns whether this cipher supports random access
bool | IsSelfInverting () const
| returns whether this transformation is self-inverting (e.g. xor with a keystream)
bool | IsForwardTransformation () const
| returns whether this is an encryption object
virtual unsigned int | GenerateBit ()
| generate new random bit and return it
virtual word32 | GenerateWord32 (word32 a=0, word32 b=0xffffffffL)
| generate a random 32 bit word in the range min to max, inclusive
virtual void | GenerateBlock (byte *output, size_t size)
| generate random array of bytes
template<class IT>
void | Shuffle (IT begin, IT end)
| randomly shuffle the specified array, resulting permutation is uniformly distributed
virtual std::string | AlgorithmName () const
| returns name of this algorithm, not universally implemented yet
virtual Clonable * | Clone () const
| this is not implemented by most classes yet
## Static Public Member Functions
static const char * | StaticAlgorithmName ()
static size_t __cdecl | StaticGetValidKeyLength (size_t n)
## Protected Member Functions
void | UncheckedSetKey (const NameValuePairs &params, const byte *key, unsigned int length, const byte *iv)
virtual unsigned int | GetDefaultDiscardBytes () const
## Protected Attributes
FixedSizeSecBlock< byte, 256 > | m_state
byte | m_x
byte | m_y

## Member Function Documentation

void ARC4_Base::DiscardBytes | ( | size_t | n | ) | `[virtual]`

generate and discard n bytes

Default implementation is to call GenerateByte() n times.

Reimplemented from RandomNumberGenerator.

Definition at line 97 of file arc4.cpp.

References m_state, m_x, and m_y.

Referenced by UncheckedSetKey().

void ARC4_Base::ProcessData | ( | byte * | outString,
|  | const byte * | inString,
|  | size_t | length |
| ) |  |  | `[virtual]`

encrypt or decrypt an array of bytes of specified length

Note:
  either inString == outString, or they don't overlap

Implements StreamTransformation.

Definition at line 68 of file arc4.cpp.

References m_state, m_x, and m_y.

unsigned int RandomNumberGenerator::GenerateBit | ( |  | ) | `[virtual, inherited]`

generate new random bit and return it

Default implementation is to call GenerateByte() and return its parity.

Reimplemented in PublicBlumBlumShub.

Definition at line 111 of file cryptlib.cpp.

References RandomNumberGenerator::GenerateByte().

Referenced by XTR_FindPrimesAndGenerator().

void RandomNumberGenerator::GenerateBlock | ( | byte * | output,
|  | size_t | size |
| ) |  |  | `[virtual, inherited]`

generate random array of bytes

Default implementation is to call GenerateByte() size times.

Reimplemented in NonblockingRng, BlockingRng, and RandomPool.

Definition at line 116 of file cryptlib.cpp.

References RandomNumberGenerator::GenerateByte().

Referenced by PSSR_MEM_Base::ComputeMessageRepresentative(), DL_GroupParameters_DSA::GenerateRandom(), OAEP_Base::Pad(), Integer::Randomize(), PolynomialMod2::Randomize(), and ElGamalBase::SymmetricEncrypt().

The documentation for this class was generated from the following files:

- arc4.h
- arc4.cpp