Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
ResultTypes.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Cryptography_Digest_ResultTypes_h_
5#define _Stroika_Foundation_Cryptography_Digest_ResultTypes_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <array>
10#include <cstdint>
11
12#include "Stroika/Foundation/Common/Common.h"
13
14/*
15 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
16 */
17
18namespace Stroika::Foundation::Cryptography::Digest {
19
20 /**
21 * 16 bytes, but 128 bits
22 */
23 using Result128BitType = array<uint8_t, 16>;
24
25 /**
26 * 20 bytes, but 160 bits
27 */
28 using Result160BitType = array<uint8_t, 20>;
29
30 /**
31 * Convert the various 'hash' / 'digest' output formats amongst each other. NOT ALL
32 * combinations are supported, but many common ones are, and this provides a convenient extention point
33 * to provide additional conversions.
34 *
35 * This allows Digester<> and Hash<> to be used and convert to types which are directly supported by
36 * the base algorithm (either throwing away bits or sometimes (zero?) filling with extra bits.
37 */
38 template <typename OUT_RESULT, typename IN_RESULT>
39 constexpr OUT_RESULT ConvertResult (IN_RESULT inResult);
40
41}
42
43/*
44 ********************************************************************************
45 ***************************** Implementation Details ***************************
46 ********************************************************************************
47 */
48#include "ResultTypes.inl"
49
50#endif /*_Stroika_Foundation_Cryptography_Digest_ResultTypes_h_*/