Botan  1.11.9
Public Member Functions | List of all members
Botan::Skein_512 Class Reference

#include <skein_512.h>

Inheritance diagram for Botan::Skein_512:
Botan::HashFunction Botan::Buffered_Computation

Public Member Functions

void clear ()
 
HashFunctionclone () const
 
void final (byte out[])
 
secure_vector< bytefinal ()
 
size_t hash_block_size () const
 
std::string name () const
 
size_t output_length () const
 
secure_vector< byteprocess (const byte in[], size_t length)
 
secure_vector< byteprocess (const secure_vector< byte > &in)
 
secure_vector< byteprocess (const std::vector< byte > &in)
 
secure_vector< byteprocess (const std::string &in)
 
 Skein_512 (size_t output_bits=512, const std::string &personalization="")
 
void update (const byte in[], size_t length)
 
void update (const secure_vector< byte > &in)
 
void update (const std::vector< byte > &in)
 
void update (const std::string &str)
 
void update (byte in)
 
template<typename T >
void update_be (const T in)
 

Detailed Description

Skein-512, a SHA-3 candidate

Definition at line 21 of file skein_512.h.

Constructor & Destructor Documentation

Botan::Skein_512::Skein_512 ( size_t  output_bits = 512,
const std::string &  personalization = "" 
)
Parameters
output_bitsthe output size of Skein in bits
personalizationis a string that will paramaterize the hash output

Definition at line 17 of file skein_512.cpp.

Referenced by clone().

18  :
19  personalization(arg_personalization),
20  output_bits(arg_output_bits),
21  m_threefish(new Threefish_512),
22  T(2), buffer(64), buf_pos(0)
23  {
24  if(output_bits == 0 || output_bits % 8 != 0 || output_bits > 512)
25  throw Invalid_Argument("Bad output bits size for Skein-512");
26 
27  initial_block();
28  }
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20

Member Function Documentation

void Botan::Skein_512::clear ( )
virtual

Implements Botan::HashFunction.

Definition at line 43 of file skein_512.cpp.

References Botan::zeroise().

44  {
45  zeroise(buffer);
46  buf_pos = 0;
47 
48  initial_block();
49  }
void zeroise(std::vector< T, Alloc > &vec)
Definition: secmem.h:166
HashFunction * Botan::Skein_512::clone ( ) const
virtual
Returns
new object representing the same algorithm as *this

Implements Botan::HashFunction.

Definition at line 38 of file skein_512.cpp.

References Skein_512().

39  {
40  return new Skein_512(output_bits, personalization);
41  }
Skein_512(size_t output_bits=512, const std::string &personalization="")
Definition: skein_512.cpp:17
void Botan::Buffered_Computation::final ( byte  out[])
inlineinherited

Complete the computation and retrieve the final result.

Parameters
outThe byte array to be filled with the result. Must be of length output_length()

Definition at line 90 of file buf_comp.h.

Referenced by Botan::X942_PRF::derive(), Botan::Hash_Filter::end_msg(), Botan::MAC_Filter::end_msg(), Botan::mgf1_mask(), Botan::SIV_Mode::S2V(), and Botan::TLS::write_record().

90 { final_result(out); }
secure_vector<byte> Botan::Buffered_Computation::final ( )
inlineinherited

Complete the computation and retrieve the final result.

Returns
secure_vector holding the result

Definition at line 97 of file buf_comp.h.

98  {
99  secure_vector<byte> output(output_length());
100  final_result(&output[0]);
101  return output;
102  }
virtual size_t output_length() const =0
size_t Botan::Skein_512::hash_block_size ( ) const
inlinevirtual
Returns
hash block size as defined for this algorithm

Reimplemented from Botan::HashFunction.

Definition at line 32 of file skein_512.h.

32 { return 64; }
std::string Botan::Skein_512::name ( ) const
virtual

Implements Botan::HashFunction.

Definition at line 30 of file skein_512.cpp.

References Botan::ASN1::to_string().

31  {
32  if(personalization != "")
33  return "Skein-512(" + std::to_string(output_bits) + "," +
34  personalization + ")";
35  return "Skein-512(" + std::to_string(output_bits) + ")";
36  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:46
size_t Botan::Skein_512::output_length ( ) const
inlinevirtual
Returns
length of the output of this function in bytes

Implements Botan::Buffered_Computation.

Definition at line 33 of file skein_512.h.

33 { return output_bits / 8; }
secure_vector<byte> Botan::Buffered_Computation::process ( const byte  in[],
size_t  length 
)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process as a byte array
lengththe length of the byte array
Returns
the result of the call to final()

Definition at line 111 of file buf_comp.h.

Referenced by Botan::HMAC_RNG::HMAC_RNG(), Botan::SIV_Mode::S2V(), Botan::RTSS_Share::split(), and Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID().

112  {
113  add_data(in, length);
114  return final();
115  }
secure_vector<byte> Botan::Buffered_Computation::process ( const secure_vector< byte > &  in)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process
Returns
the result of the call to final()

Definition at line 123 of file buf_comp.h.

124  {
125  add_data(&in[0], in.size());
126  return final();
127  }
secure_vector<byte> Botan::Buffered_Computation::process ( const std::vector< byte > &  in)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process
Returns
the result of the call to final()

Definition at line 135 of file buf_comp.h.

136  {
137  add_data(&in[0], in.size());
138  return final();
139  }
secure_vector<byte> Botan::Buffered_Computation::process ( const std::string &  in)
inlineinherited

Update and finalize computation. Does the same as calling update() and final() consecutively.

Parameters
inthe input to process as a string
Returns
the result of the call to final()

Definition at line 147 of file buf_comp.h.

References Botan::TLS::update().

148  {
149  update(in);
150  return final();
151  }
void update(const byte in[], size_t length)
Definition: buf_comp.h:34
void Botan::Buffered_Computation::update ( const byte  in[],
size_t  length 
)
inlineinherited

Add new input to process.

Parameters
inthe input to process as a byte array
lengthof param in in bytes

Definition at line 34 of file buf_comp.h.

Referenced by Botan::X942_PRF::derive(), Botan::mgf1_mask(), Botan::SIV_Mode::S2V(), and Botan::TLS::write_record().

34 { add_data(in, length); }
void Botan::Buffered_Computation::update ( const secure_vector< byte > &  in)
inlineinherited

Add new input to process.

Parameters
inthe input to process as a secure_vector

Definition at line 40 of file buf_comp.h.

41  {
42  add_data(&in[0], in.size());
43  }
void Botan::Buffered_Computation::update ( const std::vector< byte > &  in)
inlineinherited

Add new input to process.

Parameters
inthe input to process as a std::vector

Definition at line 49 of file buf_comp.h.

50  {
51  add_data(&in[0], in.size());
52  }
void Botan::Buffered_Computation::update ( const std::string &  str)
inlineinherited

Add new input to process.

Parameters
strthe input to process as a std::string. Will be interpreted as a byte array based on the strings encoding.

Definition at line 73 of file buf_comp.h.

74  {
75  add_data(reinterpret_cast<const byte*>(str.data()), str.size());
76  }
void Botan::Buffered_Computation::update ( byte  in)
inlineinherited

Process a single byte.

Parameters
inthe byte to process

Definition at line 82 of file buf_comp.h.

82 { add_data(&in, 1); }
template<typename T >
void Botan::Buffered_Computation::update_be ( const T  in)
inlineinherited

Add an integer in big-endian order

Parameters
inthe value

Definition at line 58 of file buf_comp.h.

References Botan::get_byte().

Referenced by Botan::mgf1_mask().

59  {
60  for(size_t i = 0; i != sizeof(T); ++i)
61  {
62  byte b = get_byte(i, in);
63  add_data(&b, 1);
64  }
65  }
byte get_byte(size_t byte_num, T input)
Definition: get_byte.h:21
uint8_t byte
Definition: types.h:30

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