E-MailRelay
Public Types | Static Public Member Functions | List of all members
G::HashState< N, U, S > Class Template Reference

Functions for representing the intermediate state of a hash function as a non-printable string. More...

#include <ghashstate.h>

+ Inheritance diagram for G::HashState< N, U, S >:
+ Collaboration diagram for G::HashState< N, U, S >:

Public Types

using uint_type = U
 
using size_type = S
 

Static Public Member Functions

static std::string encode (const uint_type *)
 Returns the hash state as an N-character string of non-printing characters. More...
 
static std::string encode (const uint_type *, size_type n)
 Returns the hash state as a string that also has the original data size as a four-character extension(). More...
 
static std::string encode (uint_type hi, uint_type low, const uint_type *)
 An overload with a hi/low bit count. More...
 
static std::string encode (uint_type hi, uint_type low, uint_type v0, uint_type v1, uint_type v2, uint_type v3, uint_type v4=0)
 An overload for N=16 or N=20 with broken-out values and a hi/low bit count. More...
 
static void decode (const std::string &s, uint_type *values_out, size_type &size_out)
 Converts an encode()d string back into a hash state of N/4 integers and a data size returned by reference. More...
 
static void decode (const std::string &, uint_type &size_hi_out, uint_type &size_low_out, uint_type *value_0, uint_type *value_1, uint_type *value_2, uint_type *value_3, uint_type *value_4=nullptr)
 An overload for N=16 or N=20 with broken-out values and hi/low bit count. More...
 
static void decode (const std::string &, uint_type &size_hi_out, uint_type &size_low_out, uint_type *values_out)
 An overload for a hi/low bit count. More...
 

Detailed Description

template<unsigned int N, typename U, typename S>
class G::HashState< N, U, S >

Functions for representing the intermediate state of a hash function as a non-printable string.

The input is an array of 'N/4' 32-bit values. The output is a string of N non-printable characters, or N+4 characters if also including the data size. The 'U' type can be more than 32 bits wide but it should hold values of no more than 32 bits significance.

See also
G::Hash::printable

Definition at line 62 of file ghashstate.h.

Member Typedef Documentation

◆ size_type

template<unsigned int N, typename U , typename S >
using G::HashState< N, U, S >::size_type = S

Definition at line 66 of file ghashstate.h.

◆ uint_type

template<unsigned int N, typename U , typename S >
using G::HashState< N, U, S >::uint_type = U

Definition at line 65 of file ghashstate.h.

Member Function Documentation

◆ decode() [1/3]

template<unsigned int N, typename U , typename S >
void G::HashState< N, U, S >::decode ( const std::string &  str,
uint_type &  size_hi_out,
uint_type &  size_low_out,
uint_type *  value_0,
uint_type *  value_1,
uint_type *  value_2,
uint_type *  value_3,
uint_type *  value_4 = nullptr 
)
static

An overload for N=16 or N=20 with broken-out values and hi/low bit count.

Definition at line 178 of file ghashstate.h.

◆ decode() [2/3]

template<unsigned int N, typename U , typename S >
void G::HashState< N, U, S >::decode ( const std::string &  str,
uint_type &  size_hi_out,
uint_type &  size_low_out,
uint_type *  values_out 
)
static

An overload for a hi/low bit count.

Definition at line 196 of file ghashstate.h.

◆ decode() [3/3]

template<unsigned int N, typename U , typename S >
void G::HashState< N, U, S >::decode ( const std::string &  s,
uint_type *  values_out,
size_type &  size_out 
)
static

Converts an encode()d string back into a hash state of N/4 integers and a data size returned by reference.

The data size is returned as zero if the input string is only N characters long.

Definition at line 170 of file ghashstate.h.

◆ encode() [1/4]

template<unsigned int N, typename U , typename S >
std::string G::HashState< N, U, S >::encode ( const uint_type *  values)
static

Returns the hash state as an N-character string of non-printing characters.

Definition at line 113 of file ghashstate.h.

◆ encode() [2/4]

template<unsigned int N, typename U , typename S >
std::string G::HashState< N, U, S >::encode ( const uint_type *  values,
size_type  n 
)
static

Returns the hash state as a string that also has the original data size as a four-character extension().

Definition at line 124 of file ghashstate.h.

◆ encode() [3/4]

template<unsigned int N, typename U , typename S >
std::string G::HashState< N, U, S >::encode ( uint_type  hi,
uint_type  low,
const uint_type *  values 
)
static

An overload with a hi/low bit count.

Definition at line 136 of file ghashstate.h.

◆ encode() [4/4]

template<unsigned int N, typename U , typename S >
std::string G::HashState< N, U, S >::encode ( uint_type  hi,
uint_type  low,
uint_type  v0,
uint_type  v1,
uint_type  v2,
uint_type  v3,
uint_type  v4 = 0 
)
static

An overload for N=16 or N=20 with broken-out values and a hi/low bit count.

Definition at line 145 of file ghashstate.h.


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