Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | List of all members
AdditiveCipherAbstractPolicy Class Referenceabstract

Policy object for additive stream ciphers. More...

#include <strciphr.h>

Inheritance diagram for AdditiveCipherAbstractPolicy:
[legend]

Public Member Functions

virtual ~AdditiveCipherAbstractPolicy ()
 
virtual unsigned int GetAlignment () const
 Provides data alignment requirements. More...
 
virtual unsigned int GetBytesPerIteration () const =0
 Provides number of bytes operated upon during an iteration. More...
 
virtual unsigned int GetOptimalBlockSize () const
 Provides number of ideal bytes to process. More...
 
virtual unsigned int GetIterationsToBuffer () const =0
 Provides buffer size based on iterations. More...
 
virtual void WriteKeystream (byte *keystream, size_t iterationCount)
 Generate the keystream. More...
 
virtual bool CanOperateKeystream () const
 Flag indicating. More...
 
virtual void OperateKeystream (KeystreamOperation operation, byte *output, const byte *input, size_t iterationCount)
 Operates the keystream. More...
 
virtual void CipherSetKey (const NameValuePairs &params, const byte *key, size_t length)=0
 Key the cipher. More...
 
virtual void CipherResynchronize (byte *keystreamBuffer, const byte *iv, size_t length)
 Resynchronize the cipher. More...
 
virtual bool CipherIsRandomAccess () const =0
 Flag indicating random access. More...
 
virtual void SeekToIteration (lword iterationCount)
 Seeks to a random position in the stream. More...
 

Detailed Description

Policy object for additive stream ciphers.

Definition at line 106 of file strciphr.h.

Constructor & Destructor Documentation

virtual AdditiveCipherAbstractPolicy::~AdditiveCipherAbstractPolicy ( )
inlinevirtual

Definition at line 108 of file strciphr.h.

Member Function Documentation

virtual bool AdditiveCipherAbstractPolicy::CanOperateKeystream ( ) const
inlinevirtual
virtual bool AdditiveCipherAbstractPolicy::CipherIsRandomAccess ( ) const
pure virtual

Flag indicating random access.

Returns
true if the cipher is seekable, false otherwise
See also
SeekToIteration()

Implemented in CTR_ModePolicy, OFB_ModePolicy, PanamaCipherPolicy< B >, WAKE_Policy< B >, ChaCha_Policy< R >, SosemanukPolicy, Salsa20_Policy, and SEAL_Policy< B >.

virtual void AdditiveCipherAbstractPolicy::CipherResynchronize ( byte keystreamBuffer,
const byte iv,
size_t  length 
)
inlinevirtual

Resynchronize the cipher.

Parameters
keystreamBufferthe keystream buffer
iva byte array used to resynchronize the cipher
lengththe size of the IV array

Reimplemented in CTR_ModePolicy, OFB_ModePolicy, PanamaCipherPolicy< B >, XSalsa20_Policy, ChaCha_Policy< R >, SosemanukPolicy, Salsa20_Policy, and SEAL_Policy< B >.

Definition at line 164 of file strciphr.h.

virtual void AdditiveCipherAbstractPolicy::CipherSetKey ( const NameValuePairs params,
const byte key,
size_t  length 
)
pure virtual

Key the cipher.

Parameters
paramsset of NameValuePairs use to initialize this object
keya byte array used to key the cipher
lengththe size of the key array

Implemented in PanamaCipherPolicy< B >, ModePolicyCommonTemplate< AdditiveCipherAbstractPolicy >, XSalsa20_Policy, WAKE_Policy< B >, ChaCha_Policy< R >, SosemanukPolicy, Salsa20_Policy, and SEAL_Policy< B >.

virtual unsigned int AdditiveCipherAbstractPolicy::GetAlignment ( ) const
inlinevirtual

Provides data alignment requirements.

Returns
data alignment requirements, in bytes

Internally, the default implementation returns 1. If the stream cipher is implemented using an SSE2 ASM or intrinsics, then the value returned is usually 16.

Reimplemented in AdditiveCipherConcretePolicy< word32, 20 >, AdditiveCipherConcretePolicy< word32, 8 >, AdditiveCipherConcretePolicy< word32, 256 >, AdditiveCipherConcretePolicy< word32, 16 >, AdditiveCipherConcretePolicy< word32, 1, 64 >, CTR_ModePolicy, PanamaCipherPolicy< B >, ModePolicyCommonTemplate< AdditiveCipherAbstractPolicy >, and ChaCha_Policy< R >.

Definition at line 114 of file strciphr.h.

virtual unsigned int AdditiveCipherAbstractPolicy::GetBytesPerIteration ( ) const
pure virtual

Provides number of bytes operated upon during an iteration.

Returns
bytes operated upon during an iteration, in bytes
See also
GetOptimalBlockSize()

Implemented in AdditiveCipherConcretePolicy< word32, 20 >, AdditiveCipherConcretePolicy< word32, 8 >, AdditiveCipherConcretePolicy< word32, 256 >, AdditiveCipherConcretePolicy< word32, 16 >, AdditiveCipherConcretePolicy< word32, 1, 64 >, CTR_ModePolicy, and OFB_ModePolicy.

Here is the caller graph for this function:

virtual unsigned int AdditiveCipherAbstractPolicy::GetIterationsToBuffer ( ) const
pure virtual

Provides buffer size based on iterations.

Returns
the buffer size based on iterations, in bytes

Implemented in AdditiveCipherConcretePolicy< word32, 20 >, AdditiveCipherConcretePolicy< word32, 8 >, AdditiveCipherConcretePolicy< word32, 256 >, AdditiveCipherConcretePolicy< word32, 16 >, AdditiveCipherConcretePolicy< word32, 1, 64 >, CTR_ModePolicy, and OFB_ModePolicy.

Here is the caller graph for this function:

virtual unsigned int AdditiveCipherAbstractPolicy::GetOptimalBlockSize ( ) const
inlinevirtual

Provides number of ideal bytes to process.

Returns
the ideal number of bytes to process

Internally, the default implementation returns GetBytesPerIteration()

See also
GetBytesPerIteration()

Reimplemented in ChaCha_Policy< R >.

Definition at line 125 of file strciphr.h.

Here is the caller graph for this function:

virtual void AdditiveCipherAbstractPolicy::OperateKeystream ( KeystreamOperation  operation,
byte output,
const byte input,
size_t  iterationCount 
)
inlinevirtual

Operates the keystream.

Parameters
operationthe operation with additional flags
outputthe output buffer
inputthe input buffer
iterationCountthe number of iterations to perform on the input

OperateKeystream() will attempt to operate upon GetOptimalBlockSize() buffer, which will be derived from GetBytesPerIteration().

See also
CanOperateKeystream(), OperateKeystream(), WriteKeystream(), KeystreamOperation()

Reimplemented in AdditiveCipherConcretePolicy< word32, 20 >, AdditiveCipherConcretePolicy< word32, 8 >, AdditiveCipherConcretePolicy< word32, 256 >, AdditiveCipherConcretePolicy< word32, 16 >, AdditiveCipherConcretePolicy< word32, 1, 64 >, CTR_ModePolicy, PanamaCipherPolicy< B >, WAKE_Policy< B >, ChaCha_Policy< R >, SosemanukPolicy, Salsa20_Policy, and SEAL_Policy< B >.

Definition at line 151 of file strciphr.h.

virtual void AdditiveCipherAbstractPolicy::SeekToIteration ( lword  iterationCount)
inlinevirtual

Seeks to a random position in the stream.

Returns
iterationCount
See also
CipherIsRandomAccess()

Reimplemented in CTR_ModePolicy, ChaCha_Policy< R >, Salsa20_Policy, and SEAL_Policy< B >.

Definition at line 175 of file strciphr.h.

virtual void AdditiveCipherAbstractPolicy::WriteKeystream ( byte keystream,
size_t  iterationCount 
)
inlinevirtual

Generate the keystream.

Parameters
keystreamthe key stream
iterationCountthe number of iterations to generate the key stream
See also
CanOperateKeystream(), OperateKeystream(), WriteKeystream()

Reimplemented in CTR_ModePolicy, and OFB_ModePolicy.

Definition at line 135 of file strciphr.h.

Here is the call graph for this function:


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