AESCounter< S > Class Template Reference

Generic AES Counter class. More...

`#include <AESCounter.h>`

Inheritance diagram for AESCounter< S >:
[legend]
Collaboration diagram for AESCounter< S >:
[legend]

## Public Types

typedef uint8_t | counter_t[S/8]
| Type for this size of AES counter.
typedef uint8_t | counter_t[S/8]
| Type for this size of AES counter.

## Public Member Functions

| AESCounter ()
| Default constructor. More...
| AESCounter (const counter_t &counter)
| Constructor taking a counter value reference.
| AESCounter (const counter_t *counter)
| AESCounter (std::istream &stream)
| Constructor, reads counter from stream in hex format.
| AESCounter (const AESCounter< S > &other)
| Copy constructor.
| ~AESCounter ()
| Destructor. More...
void | randomize ()
| Set to the counter to a randomly generated value.
void | readFromStream (std::istream &stream)
| Reads the counter from a hex encoded data stream.
void | writeToStream (std::ostream &stream) const
| Writes the counter to a data stream in hex encoded format.
void | incrementCounter (unsigned val)
| Increments the counter by val.
| AESCounter ()
| Default constructor. More...
| AESCounter (const counter_t &counter)
| Constructor taking a counter value reference.
| AESCounter (const counter_t *counter)
| AESCounter (std::istream &stream)
| Constructor, reads counter from stream in hex format.
| AESCounter (const AESCounter< S > &other)
| Copy constructor.
| ~AESCounter ()
| Destructor. More...
void | randomize ()
| Set to the counter to a randomly generated value.
void | readFromStream (std::istream &stream)
| Reads the counter from a hex encoded data stream.
void | writeToStream (std::ostream &stream) const
| Writes the counter to a data stream in hex encoded format.
void | incrementCounter (unsigned val)
| Increments the counter by val.
Counter accessors
const counter_t & | getCounter () const
void | getCounter (counter_t *counter) const
void | setCounter (const counter_t &counter)
void | setCounter (const counter_t *counter)
void | setCounter (const AESCounter< S > &counter)
const counter_t & | getCounter () const
void | getCounter (counter_t *counter) const
void | setCounter (const counter_t &counter)
void | setCounter (const counter_t *counter)
void | setCounter (const AESCounter< S > &counter)
Public Member Functions inherited from AESCounterBase
void | _readFromStream (std::istream &stream, unsigned bytes, uint8_t *buffer)
| Reads hex encoded data from stream. More...
void | _writeToStream (std::ostream &stream, unsigned bytes, const uint8_t *buffer) const
| Writes hex encoded data to stream. More...
void | _readFromStream (std::istream &stream, unsigned bytes, uint8_t *buffer)
| Reads hex encoded data from stream.
void | _writeToStream (std::ostream &stream, unsigned bytes, const uint8_t *buffer) const
| Writes hex encoded data to stream.

## Protected Attributes

counter_t | m_counter
| The counter value.

## Operators

const AESCounter< S > & | operator= (const AESCounter< S > &counter)
const AESCounter< S > & | operator= (const counter_t &counter)
const AESCounter< S > & | operator= (const counter_t *counter)
| operator const counter_t & () const
| operator const counter_t * () const
const AESCounter< S > & | operator= (const AESCounter< S > &counter)
const AESCounter< S > & | operator= (const counter_t &counter)
const AESCounter< S > & | operator= (const counter_t *counter)
| operator const counter_t & () const
| operator const counter_t * () const
std::ostream & | operator<< (std::ostream &os, const AESCounter< S > &counter)
std::ostream & | operator<< (std::ostream &os, const AESCounter< S > &counter)

## Detailed Description

### template<int S>
class AESCounter< S >

Generic AES Counter class.

The template parameter S is the number of bits in the counter.

The underlying counter type can be accessed like this: AESCounter<128>::counter_t

When a counter instance is destroyed, it erases the counter data by setting it to all zeroes.

AESCounter<128> counter = AESCounter<128>::readFromStream(s);

The template parameter S is the number of bits in the counter.

The underlying counter type can be accessed like this: AESCounter<128>::counter_t

When a counter instance is destroyed, it erases the counter data by setting it to all zeroes.

AESCounter<128> counter = AESCounter<128>::readFromStream(s);

## Constructor & Destructor Documentation

template<int S>

AESCounter< S >::AESCounter | ( |  | ) |

inline

Default constructor.

Initializes the counter to 0.

template<int S>

AESCounter< S >::~AESCounter | ( |  | ) |

inline

Destructor.

Sets the counter value to zero.

template<int S>

AESCounter< S >::AESCounter | ( |  | ) |

inline

Default constructor.

Initializes the counter to 0.

template<int S>

AESCounter< S >::~AESCounter | ( |  | ) |

inline

Destructor.

Sets the counter value to zero.

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

- apps/elftosb/common/AESCounter.h