xrpld
Loading...
Searching...
No Matches
xrpl::HardenedHash< HashAlgorithm > Class Template Reference

Seed functor once per construction. More...

#include <hardened_hash.h>

Collaboration diagram for xrpl::HardenedHash< HashAlgorithm >:

Public Types

using result_type = HashAlgorithm::result_type

Public Member Functions

 HardenedHash ()=default
template<class T>
result_type operator() (T const &t) const noexcept

Private Attributes

detail::seed_pair seeds_ {detail::makeSeedPair<>()}

Detailed Description

template<class HashAlgorithm = beast::Xxhasher>
class xrpl::HardenedHash< HashAlgorithm >

Seed functor once per construction.

A std compatible hash adapter that resists adversarial inputs. For this to work, T must implement in its own namespace:

template <class Hasher>
void
hash_append (Hasher& h, T const& t) noexcept
{
// hash_append each base and member that should
// participate in forming the hash
hash_append (h, static_cast<T::base1 const&>(t));
hash_append (h, static_cast<T::base2 const&>(t));
// ...
hash_append (h, t.member1);
hash_append (h, t.member2);
// ...
}
std::enable_if_t< IsContiguouslyHashable< T, Hasher >::value > hash_append(Hasher &h, T const &t) noexcept
Logically concatenate input data to a Hasher.
void hash_append(Hasher &h, Slice const &v)
Definition Slice.h:175

Do not use any version of Murmur or CityHash for the Hasher template parameter (the hashing algorithm). For details see https://131002.net/siphash/#at

Definition at line 72 of file hardened_hash.h.

Member Typedef Documentation

◆ result_type

template<class HashAlgorithm = beast::Xxhasher>
using xrpl::HardenedHash< HashAlgorithm >::result_type = HashAlgorithm::result_type

Definition at line 78 of file hardened_hash.h.

Constructor & Destructor Documentation

◆ HardenedHash()

template<class HashAlgorithm = beast::Xxhasher>
xrpl::HardenedHash< HashAlgorithm >::HardenedHash ( )
default

Member Function Documentation

◆ operator()()

template<class HashAlgorithm = beast::Xxhasher>
template<class T>
result_type xrpl::HardenedHash< HashAlgorithm >::operator() ( T const & t) const
noexcept

Definition at line 84 of file hardened_hash.h.

Member Data Documentation

◆ seeds_

template<class HashAlgorithm = beast::Xxhasher>
detail::seed_pair xrpl::HardenedHash< HashAlgorithm >::seeds_ {detail::makeSeedPair<>()}
private

Definition at line 75 of file hardened_hash.h.