CoreComponents 3.0.0
A Modern C++ Toolkit
Loading...
Searching...
No Matches
Keccak< Capacity, Padding, Source, Sink > Class Template Reference

Keccak sponge function More...

#include <cc/Keccak>

Public Member Functions

 Keccak ()
 Create new instance.
 
 Keccak (const Bytes &key)
 Create new instance.
 
bool absorb (Source source)
 Absorb a chunk of input data (FeedRate bytes at a time)
 
void squeeze (Sink sink)
 Generate output bytes out of the sponge (FeedRate bytes at a time)
 

Static Public Attributes

static constexpr int FeedRate = (1600 - Capacity) / 8
 Rate of the sponge function (in bytes)
 

Detailed Description

template<int Capacity = 1024, class Padding = KeccakPadding, class Source = KeccakSource<Capacity, Padding>, class Sink = KeccakSink>
class cc::Keccak< Capacity, Padding, Source, Sink >

Keccak sponge function

Template Parameters
CapacityCapacity of the sponge function
PaddingAdditional padding sequence to apply
SourcePolicy of reading input bytes and automatically applying padding bytes

The Keccak template class implements the Keccak[c] sponge function according to NIST.FIPS.202, chapter 5.2.

Constructor & Destructor Documentation

◆ Keccak() [1/2]

template<int Capacity, class Padding , class Source , class Sink >
Keccak ( )

Create new instance.

◆ Keccak() [2/2]

template<int Capacity, class Padding , class Source , class Sink >
Keccak ( const Bytes & key)

Create new instance.

Parameters
keyInitial state bytes

Member Function Documentation

◆ absorb()

template<int Capacity, class Padding , class Source , class Sink >
bool absorb ( Source source)

Absorb a chunk of input data (FeedRate bytes at a time)

Parameters
sourceSource to read a single chunk of data from
Returns
true if more data can be absorbed

◆ squeeze()

template<int Capacity, class Padding , class Source , class Sink >
void squeeze ( Sink sink)

Generate output bytes out of the sponge (FeedRate bytes at a time)

Parameters
sinkSink to write output bytes to

Member Data Documentation

◆ FeedRate

template<int Capacity = 1024, class Padding = KeccakPadding, class Source = KeccakSource<Capacity, Padding>, class Sink = KeccakSink>
constexpr int FeedRate = (1600 - Capacity) / 8
staticconstexpr

Rate of the sponge function (in bytes)