Shacal2. Merkle-Damgård construction foundation for SHA2 hashes. Accepts up to a 512-bit key. Fast and seemingly very secure, but obscure. Standardized by NESSIE. More...

#include <shacal2.hpp>

+ Collaboration diagram for nil::crypto3::block::shacal2< BlockBits >:

Classes

struct  stream_processor
 

Public Types

typedef policy_type::block_type block_type
 
typedef stream_endian::little_octet_big_bit endian_type
 
typedef policy_type::key_schedule_type key_schedule_type
 
typedef policy_type::key_type key_type
 
typedef policy_type::word_type word_type
 

Public Member Functions

block_type decrypt (const block_type &ciphertext) const
 
block_type encrypt (block_type const &plaintext) const
 
 shacal2 (const key_type &key)
 
 shacal2 (key_schedule_type s)
 

Static Public Attributes

constexpr static const std::size_t block_bits = policy_type::block_bits
 
constexpr static const std::size_t block_words = policy_type::block_words
 
constexpr static const std::size_t key_bits = policy_type::key_bits
 
constexpr static const std::size_t key_words = policy_type::key_words
 
static const std::size_t rounds = policy_type::rounds
 
constexpr static const std::size_t version = BlockBits
 
constexpr static const std::size_t word_bits = policy_type::word_bits
 

Protected Member Functions

block_type decrypt_block (const block_type &ciphertext) const
 
block_type encrypt_block (const block_type &plaintext) const
 

Static Protected Member Functions

static key_schedule_type build_schedule (const key_type &key)
 
static block_type decrypt_block (const key_schedule_type &schedule, const block_type &ciphertext)
 
static block_type encrypt_block (const key_schedule_type &schedule, block_type const &plaintext)
 
static void prepare_schedule (key_schedule_type &schedule)
 

Protected Attributes

const key_schedule_type schedule
 

Detailed Description

template<std::size_t BlockBits>
class nil::crypto3::block::shacal2< BlockBits >

Shacal2. Merkle-Damgård construction foundation for SHA2 hashes. Accepts up to a 512-bit key. Fast and seemingly very secure, but obscure. Standardized by NESSIE.

Encrypt implemented directly from the SHA standard as found at http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf

Decrypt is a straight-forward inverse

In SHA terminology:

  • plaintext = H^(i-1)
  • ciphertext = H^(i)
  • key = M^(i)
  • schedule = W
Template Parameters
BlockBitsBlock cipher block bits. Available values are: 256, 512

Member Typedef Documentation

◆ block_type

template<std::size_t BlockBits>
typedef policy_type::block_type nil::crypto3::block::shacal2< BlockBits >::block_type

◆ endian_type

template<std::size_t BlockBits>
typedef stream_endian::little_octet_big_bit nil::crypto3::block::shacal2< BlockBits >::endian_type

◆ key_schedule_type

template<std::size_t BlockBits>
typedef policy_type::key_schedule_type nil::crypto3::block::shacal2< BlockBits >::key_schedule_type

◆ key_type

template<std::size_t BlockBits>
typedef policy_type::key_type nil::crypto3::block::shacal2< BlockBits >::key_type

◆ word_type

template<std::size_t BlockBits>
typedef policy_type::word_type nil::crypto3::block::shacal2< BlockBits >::word_type

Constructor & Destructor Documentation

◆ shacal2() [1/2]

template<std::size_t BlockBits>
nil::crypto3::block::shacal2< BlockBits >::shacal2 ( const key_type key)
inline

◆ shacal2() [2/2]

template<std::size_t BlockBits>
nil::crypto3::block::shacal2< BlockBits >::shacal2 ( key_schedule_type  s)
inline

Member Function Documentation

◆ build_schedule()

template<std::size_t BlockBits>
static key_schedule_type nil::crypto3::block::shacal2< BlockBits >::build_schedule ( const key_type key)
inlinestaticprotected

◆ decrypt()

template<std::size_t BlockBits>
block_type nil::crypto3::block::shacal2< BlockBits >::decrypt ( const block_type ciphertext) const
inline

◆ decrypt_block() [1/2]

template<std::size_t BlockBits>
block_type nil::crypto3::block::shacal2< BlockBits >::decrypt_block ( const block_type ciphertext) const
inlineprotected

◆ decrypt_block() [2/2]

template<std::size_t BlockBits>
static block_type nil::crypto3::block::shacal2< BlockBits >::decrypt_block ( const key_schedule_type schedule,
const block_type ciphertext 
)
inlinestaticprotected

◆ encrypt()

template<std::size_t BlockBits>
block_type nil::crypto3::block::shacal2< BlockBits >::encrypt ( block_type const &  plaintext) const
inline

◆ encrypt_block() [1/2]

template<std::size_t BlockBits>
block_type nil::crypto3::block::shacal2< BlockBits >::encrypt_block ( const block_type plaintext) const
inlineprotected

◆ encrypt_block() [2/2]

template<std::size_t BlockBits>
static block_type nil::crypto3::block::shacal2< BlockBits >::encrypt_block ( const key_schedule_type schedule,
block_type const &  plaintext 
)
inlinestaticprotected

◆ prepare_schedule()

template<std::size_t BlockBits>
static void nil::crypto3::block::shacal2< BlockBits >::prepare_schedule ( key_schedule_type schedule)
inlinestaticprotected

Member Data Documentation

◆ block_bits

template<std::size_t BlockBits>
constexpr static const std::size_t nil::crypto3::block::shacal2< BlockBits >::block_bits = policy_type::block_bits
staticconstexpr

◆ block_words

template<std::size_t BlockBits>
constexpr static const std::size_t nil::crypto3::block::shacal2< BlockBits >::block_words = policy_type::block_words
staticconstexpr

◆ key_bits

template<std::size_t BlockBits>
constexpr static const std::size_t nil::crypto3::block::shacal2< BlockBits >::key_bits = policy_type::key_bits
staticconstexpr

◆ key_words

template<std::size_t BlockBits>
constexpr static const std::size_t nil::crypto3::block::shacal2< BlockBits >::key_words = policy_type::key_words
staticconstexpr

◆ rounds

template<std::size_t BlockBits>
const std::size_t nil::crypto3::block::shacal2< BlockBits >::rounds = policy_type::rounds
static

◆ schedule

template<std::size_t BlockBits>
const key_schedule_type nil::crypto3::block::shacal2< BlockBits >::schedule
protected

◆ version

template<std::size_t BlockBits>
constexpr static const std::size_t nil::crypto3::block::shacal2< BlockBits >::version = BlockBits
staticconstexpr

◆ word_bits

template<std::size_t BlockBits>
constexpr static const std::size_t nil::crypto3::block::shacal2< BlockBits >::word_bits = policy_type::word_bits
staticconstexpr

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