Stroika Library 3.0d16
 
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 // see https://stackoverflow.com/questions/65127936/defining-a-c20-concept-for-hash-functions
22 // https://en.cppreference.com/w/cpp/utility/hash
23 template <typename FUNCTION, typename HASHABLE_T>
24 concept IHashFunction = std::regular_invocable<FUNCTION, HASHABLE_T> && requires (FUNCTION f, HASHABLE_T t) {
25 { std::invoke (f, t) } -> std::convertible_to<size_t>;
26 };
27}
28
29/*
30 ********************************************************************************
31 ***************************** Implementation Details ***************************
32 ********************************************************************************
33 */
34#include "HashBase.inl"
35
36#endif /*_Stroika_Foundation_Cryptography_Digest_HashBase_h_*/