Kicking it Olde Sküül! Burgerlib on Github Follow Olde Sküül on Twitter Burgerbecky on LinkedIn Burgerbecky on LinkedIn
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Burger::GOSTHasher_t Struct Reference

Multi-pass GOST hash generator. More...

Collaboration diagram for Burger::GOSTHasher_t:
Collaboration graph
[legend]

Public Member Functions

void init (void) noexcept
 Initialize the GOST hasher.
 
void process (const uint32_t pBlock[8]) noexcept
 Process a single 8 32-bit integer block of data.
 
void process (const uint8_t pBlock[32]) noexcept
 Process a 32 byte block of data.
 
void process (const void *pInput, uintptr_t uLength) noexcept
 Process an arbitrary number of input bytes.
 
void finalize (void) noexcept
 Finalize the hashing.
 

Public Attributes

GOST_t m_Hash
 Current 256 bit value.
 
uint64_t m_uByteCount
 Number of bytes processed (64 bit value)
 
uint64_t m_uTotalCount
 Number of bits processed.
 
uint32_t m_uNativeHash [8]
 Hash in native endian.
 
uint32_t m_uSum [8]
 Running data sum.
 
uint8_t m_CacheBuffer [32]
 Input buffer for processing.
 

Static Public Attributes

static const uint32_t g_TestParmsSBox [8][16]
 Test parameters S-Box, as copied from Wikipedia.
 
static const uint32_t g_SBoxTable [4][256]
 Precalculated SBoxTable using g_TestParmsSBox input.
 

Detailed Description

Multi-pass GOST hash generator.


Full documentation on this hash format can be found here https://en.wikipedia.org/wiki/GOST_(hash_function)

This structure is needed to perform a multi-pass GOST hash and contains cached data and a running checksum.

// Initialize
Context.init();
// Process data in passes
Context.process(Buffer1,sizeof(Buffer1));
Context.process(Buffer2,sizeof(Buffer2));
Context.process(Buffer3,sizeof(Buffer3));
// Wrap up the processing
Context.finalize();
// Return the resulting hash
MemoryCopy(pOutput,&Context.m_Hash,32);
void MemoryCopy(void *pOutput, const void *pInput, uintptr_t uCount) noexcept
Copy raw memory from one buffer to another.
Definition brmemoryfunctions.cpp:186
Multi-pass GOST hash generator.
Definition burger.h:7267
GOST_t m_Hash
Current 256 bit value.
Definition burger.h:7270
void process(const uint32_t pBlock[8]) noexcept
Process a single 8 32-bit integer block of data.
Definition brgost.cpp:319
void finalize(void) noexcept
Finalize the hashing.
Definition brgost.cpp:666
void init(void) noexcept
Initialize the GOST hasher.
Definition brgost.cpp:282
See also
GOST_t or hash(GOST_t *,const void *,uintptr_t)

Member Function Documentation

◆ finalize()

void BURGER_API Burger::GOSTHasher_t::finalize ( void )
noexcept

Finalize the hashing.


When multi-pass hashing is performed, this call is necessary to finalize the hash so that the generated checksum can be applied into the hash

See also
init(void), process(const void *,uintptr_t)

◆ init()

void BURGER_API Burger::GOSTHasher_t::init ( void )
noexcept

Initialize the GOST hasher.


Call this function before any hashing is performed

See also
process(const void *,uintptr_t) or finalize(void)

◆ process() [1/3]

void BURGER_API Burger::GOSTHasher_t::process ( const uint32_t pBlock[8])
noexcept

Process a single 8 32-bit integer block of data.


GOST data is processed in 8 32-bit chunks. This function will process 32 bytes on input and update the hash and checksum

Parameters
pBlockPointer to a buffer of 8 32 bit values in native endian to hash
See also
process(const void *,uintptr_t), finalize(void) or init(void)

◆ process() [2/3]

void BURGER_API Burger::GOSTHasher_t::process ( const uint8_t pBlock[32])
noexcept

Process a 32 byte block of data.


GOST data is processed in 8 32-bit chunks. This function will convert 32 bytes of data arranged as non-aligned array of 8 32 bit little endian integers and pass them to the actual function to do the data processing

Parameters
pBlockPointer to a buffer of 32 byte values to hash
See also
process(const void *,uintptr_t), finalize(void) or init(void)

◆ process() [3/3]

void BURGER_API Burger::GOSTHasher_t::process ( const void * pInput,
uintptr_t uLength )
noexcept

Process an arbitrary number of input bytes.


Process input data into the hash. If data chunks are not a multiple of 64 bytes, the excess will be cached and a future call will continue the hashing where it left off.

Parameters
pInputPointer to a buffer of data to hash
uLengthNumber of bytes to hash
See also
process(const uint8_t[32]), finalize(void)

Member Data Documentation

◆ g_SBoxTable

const uint32_t Burger::GOSTHasher_t::g_SBoxTable
static

Precalculated SBoxTable using g_TestParmsSBox input.


Full documentation on this hash format can be found here https://en.wikipedia.org/wiki/GOST_(hash_function)

See also
GOSTHasher_t

◆ g_TestParmsSBox

const uint32_t Burger::GOSTHasher_t::g_TestParmsSBox
static
Initial value:
= {
{4, 10, 9, 2, 13, 8, 0, 14, 6, 11, 1, 12, 7, 15, 5, 3},
{14, 11, 4, 12, 6, 13, 15, 10, 2, 3, 8, 1, 0, 7, 5, 9},
{5, 8, 1, 13, 10, 3, 4, 2, 14, 15, 12, 7, 6, 0, 9, 11},
{7, 13, 10, 1, 0, 8, 9, 15, 14, 4, 6, 12, 11, 2, 5, 3},
{6, 12, 7, 1, 5, 15, 13, 8, 4, 10, 9, 14, 0, 3, 11, 2},
{4, 11, 10, 0, 7, 2, 1, 13, 3, 6, 8, 5, 9, 12, 15, 14},
{13, 11, 4, 1, 3, 15, 5, 9, 0, 10, 14, 7, 6, 8, 2, 12},
{1, 15, 13, 0, 5, 7, 10, 4, 9, 2, 3, 14, 6, 11, 8, 12}}

Test parameters S-Box, as copied from Wikipedia.


GOST test parameters for an S-Box.

Full documentation on this hash format can be found here https://en.wikipedia.org/wiki/GOST_(hash_function)

See also
GOSTHasher_t

◆ m_CacheBuffer

uint8_t Burger::GOSTHasher_t::m_CacheBuffer[32]

Input buffer for processing.

◆ m_Hash

GOST_t Burger::GOSTHasher_t::m_Hash

Current 256 bit value.

◆ m_uByteCount

uint64_t Burger::GOSTHasher_t::m_uByteCount

Number of bytes processed (64 bit value)

◆ m_uNativeHash

uint32_t Burger::GOSTHasher_t::m_uNativeHash[8]

Hash in native endian.

◆ m_uSum

uint32_t Burger::GOSTHasher_t::m_uSum[8]

Running data sum.

◆ m_uTotalCount

uint64_t Burger::GOSTHasher_t::m_uTotalCount

Number of bits processed.