Stroika Library 3.0d18
 
Loading...
Searching...
No Matches
HashBase.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Cryptography_Digest_HashBase_h_
5#define _Stroika_Foundation_Cryptography_Digest_HashBase_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <concepts>
10#include <functional>
11
12/*
13 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
14 *
15 * \note - this separate file exists to avoid mutual include issues - it logically would make sense to
16 * include this in Hash.h
17 */
18
19namespace Stroika::Foundation::Cryptography::Digest {
20
21 /**
22 * \brief check argument FUNCTION is callable with a HASHABLE_T, and produces (something convertible to) size_t
23 *
24 * see https://stackoverflow.com/questions/65127936/defining-a-c20-concept-for-hash-functions
25 * https://en.cppreference.com/w/cpp/utility/hash
26 */
27 template <typename FUNCTION, typename HASHABLE_T>
28 concept IHashFunction = std::regular_invocable<FUNCTION, HASHABLE_T> && requires (FUNCTION f, HASHABLE_T t) {
29 { std::invoke (f, t) } -> std::convertible_to<size_t>;
30 };
31}
32
33/*
34 ********************************************************************************
35 ***************************** Implementation Details ***************************
36 ********************************************************************************
37 */
38#include "HashBase.inl"
39
40#endif /*_Stroika_Foundation_Cryptography_Digest_HashBase_h_*/
check argument FUNCTION is callable with a HASHABLE_T, and produces (something convertible to) size_t
Definition HashBase.h:28