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

A custom weaker variant of SipHash-1-3 without padding, and supporting "jumbo" inputs. More...

#include <siphash.h>

Collaboration diagram for SipHasher13UJ:
[legend]

Public Member Functions

 SipHasher13UJ (uint64_t k0, uint64_t k1) noexcept
 Construct a SipHash-1-3-UJ calculator initialized with 128-bit key (k0, k1). More...
 
SipHasher13UJWrite (uint64_t data) noexcept
 Hash a normal 64-bit value. More...
 
SipHasher13UJWriteJumbo (const uint256 &hash) noexcept
 Hash a 256-bit value as a jumbo block. More...
 
uint64_t Finalize () const noexcept
 Compute the 64-bit SipHash-1-3-UJ of the data written so far. More...
 
ALWAYS_INLINE uint64_t Hash (const uint256 &hash) const noexcept
 Hash a jumbo block after the data written so far and finalize without modifying the object. More...
 
ALWAYS_INLINE uint64_t Hash (const uint256 &hash, uint64_t extra) const noexcept
 Hash a jumbo block followed by a normal block after the data written so far, and finalize without modifying the object. More...
 

Private Attributes

SipHashState m_state
 

Detailed Description

A custom weaker variant of SipHash-1-3 without padding, and supporting "jumbo" inputs.

Compared to the traditional SipHash-2-4, this incorporates 3 changes:

Other components are unchanged: initialization constants, SipRound, and 64-bit output. This interface serves as an executable specification for fixed-width implementations. The Hash overloads optimize fixed-width inputs without modifying the accumulated state.

Definition at line 160 of file siphash.h.

Constructor & Destructor Documentation

◆ SipHasher13UJ()

SipHasher13UJ::SipHasher13UJ ( uint64_t  k0,
uint64_t  k1 
)
inlinenoexcept

Construct a SipHash-1-3-UJ calculator initialized with 128-bit key (k0, k1).

Definition at line 166 of file siphash.h.

Member Function Documentation

◆ Finalize()

uint64_t SipHasher13UJ::Finalize ( ) const
noexcept

Compute the 64-bit SipHash-1-3-UJ of the data written so far.

The object remains untouched.

Definition at line 64 of file siphash.cpp.

Here is the call graph for this function:

◆ Hash() [1/2]

ALWAYS_INLINE uint64_t SipHasher13UJ::Hash ( const uint256 hash) const
inlinenoexcept

Hash a jumbo block after the data written so far and finalize without modifying the object.

Definition at line 175 of file siphash.h.

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

◆ Hash() [2/2]

ALWAYS_INLINE uint64_t SipHasher13UJ::Hash ( const uint256 hash,
uint64_t  extra 
) const
inlinenoexcept

Hash a jumbo block followed by a normal block after the data written so far, and finalize without modifying the object.

Definition at line 186 of file siphash.h.

Here is the call graph for this function:

◆ Write()

SipHasher13UJ & SipHasher13UJ::Write ( uint64_t  data)
noexcept

Hash a normal 64-bit value.

Definition at line 52 of file siphash.cpp.

Here is the caller graph for this function:

◆ WriteJumbo()

SipHasher13UJ & SipHasher13UJ::WriteJumbo ( const uint256 hash)
noexcept

Hash a 256-bit value as a jumbo block.

For hash-table use, non-hash inputs must remain few and bounded.

Definition at line 58 of file siphash.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_state

SipHashState SipHasher13UJ::m_state
private

Definition at line 162 of file siphash.h.


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