Bitcoin Core 31.99.0
P2P Digital Currency
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SipHashState Class Reference

Shared SipHash state (v0..v3) with its round, compression, and finalization primitives. More...

#include <siphash.h>

Public Member Functions

ALWAYS_INLINE SipHashState (uint64_t k0, uint64_t k1) noexcept
 Construct a SipHashState initialized with the specified key. More...
 
ALWAYS_INLINE SipHashState Copy () const noexcept
 Construct a copy of this state. More...
 
ALWAYS_INLINE SipHashStateCompress1 (uint64_t data) noexcept
 Mutably compress one block into this state, with 1 SipRound. More...
 
ALWAYS_INLINE SipHashStateCompress1Jumbo (const uint256 &data) noexcept
 Mutably compress one jumbo block into this state, with 1 SipRound. More...
 
ALWAYS_INLINE SipHashStateCompress2 (uint64_t data) noexcept
 Mutably compress one block into this state, with 2 SipRounds. More...
 
ALWAYS_INLINE uint64_t Finalize4 () noexcept
 Mutably finalize this state with 4 SipRounds, and return the resulting hash. More...
 
ALWAYS_INLINE uint64_t Finalize3U () noexcept
 Mutably finalize this state with 3 SipRounds using the unpadded finalizer, and return the resulting hash. More...
 

Private Member Functions

ALWAYS_INLINE SipHashState (uint64_t v0, uint64_t v1, uint64_t v2, uint64_t v3) noexcept
 Construct a SipHashState with the specified values as state. More...
 
ALWAYS_INLINE void SipRound () noexcept
 Mutably perform one SipRound on this state. More...
 

Private Attributes

uint64_t m_v0
 State variables. More...
 
uint64_t m_v1
 
uint64_t m_v2
 
uint64_t m_v3
 

Static Private Attributes

static constexpr uint64_t C0 {0x736f6d6570736575}
 SipHash initialization constants. More...
 
static constexpr uint64_t C1 {0x646f72616e646f6d}
 
static constexpr uint64_t C2 {0x6c7967656e657261}
 
static constexpr uint64_t C3 {0x7465646279746573}
 
static constexpr uint64_t FINALIZER {0xFF}
 SipHash v2 finalizer constant. More...
 
static constexpr uint64_t FINALIZER_UNPADDED {0x6465646461706e75}
 SipHash custom unpadded finalizer constant. More...
 

Detailed Description

Shared SipHash state (v0..v3) with its round, compression, and finalization primitives.

Internal building block, only meant to be composed by the hasher classes below.

Definition at line 17 of file siphash.h.

Constructor & Destructor Documentation

◆ SipHashState() [1/2]

ALWAYS_INLINE SipHashState::SipHashState ( uint64_t  v0,
uint64_t  v1,
uint64_t  v2,
uint64_t  v3 
)
inlineprivatenoexcept

Construct a SipHashState with the specified values as state.

Definition at line 28 of file siphash.h.

◆ SipHashState() [2/2]

ALWAYS_INLINE SipHashState::SipHashState ( uint64_t  k0,
uint64_t  k1 
)
inlineexplicitnoexcept

Construct a SipHashState initialized with the specified key.

Definition at line 46 of file siphash.h.

Member Function Documentation

◆ Compress1()

ALWAYS_INLINE SipHashState & SipHashState::Compress1 ( uint64_t  data)
inlinenoexcept

Mutably compress one block into this state, with 1 SipRound.

Definition at line 50 of file siphash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Compress1Jumbo()

ALWAYS_INLINE SipHashState & SipHashState::Compress1Jumbo ( const uint256 data)
inlinenoexcept

Mutably compress one jumbo block into this state, with 1 SipRound.

Definition at line 58 of file siphash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Compress2()

ALWAYS_INLINE SipHashState & SipHashState::Compress2 ( uint64_t  data)
inlinenoexcept

Mutably compress one block into this state, with 2 SipRounds.

Definition at line 67 of file siphash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Copy()

ALWAYS_INLINE SipHashState SipHashState::Copy ( ) const
inlinenoexcept

Construct a copy of this state.

Definition at line 48 of file siphash.h.

Here is the caller graph for this function:

◆ Finalize3U()

ALWAYS_INLINE uint64_t SipHashState::Finalize3U ( )
inlinenoexcept

Mutably finalize this state with 3 SipRounds using the unpadded finalizer, and return the resulting hash.

Definition at line 87 of file siphash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Finalize4()

ALWAYS_INLINE uint64_t SipHashState::Finalize4 ( )
inlinenoexcept

Mutably finalize this state with 4 SipRounds, and return the resulting hash.

Definition at line 76 of file siphash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SipRound()

ALWAYS_INLINE void SipHashState::SipRound ( )
inlineprivatenoexcept

Mutably perform one SipRound on this state.

Definition at line 34 of file siphash.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ C0

constexpr uint64_t SipHashState::C0 {0x736f6d6570736575}
staticconstexprprivate

SipHash initialization constants.

Definition at line 20 of file siphash.h.

◆ C1

constexpr uint64_t SipHashState::C1 {0x646f72616e646f6d}
staticprivate

Definition at line 20 of file siphash.h.

◆ C2

constexpr uint64_t SipHashState::C2 {0x6c7967656e657261}
staticprivate

Definition at line 20 of file siphash.h.

◆ C3

constexpr uint64_t SipHashState::C3 {0x7465646279746573}
staticprivate

Definition at line 20 of file siphash.h.

◆ FINALIZER

constexpr uint64_t SipHashState::FINALIZER {0xFF}
staticconstexprprivate

SipHash v2 finalizer constant.

Definition at line 22 of file siphash.h.

◆ FINALIZER_UNPADDED

constexpr uint64_t SipHashState::FINALIZER_UNPADDED {0x6465646461706e75}
staticconstexprprivate

SipHash custom unpadded finalizer constant.

Definition at line 24 of file siphash.h.

◆ m_v0

uint64_t SipHashState::m_v0
private

State variables.

Definition at line 31 of file siphash.h.

◆ m_v1

uint64_t SipHashState::m_v1
private

Definition at line 31 of file siphash.h.

◆ m_v2

uint64_t SipHashState::m_v2
private

Definition at line 31 of file siphash.h.

◆ m_v3

uint64_t SipHashState::m_v3
private

Definition at line 31 of file siphash.h.


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