Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
Jenkins.h
Go to the documentation of this file.
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_Cryptography_Digest_Jenkins_h_
5#define _Stroika_Foundation_Cryptography_Digest_Jenkins_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <cstdint>
10
11#include "Stroika/Foundation/Cryptography/Digest/Digester.h"
12
13/**
14 * \file
15 *
16 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
17 *
18 * @see http://en.wikipedia.org/wiki/Jenkins_hash_function
19 *
20 *
21 * TODO:
22 * @todo Add other hashes - listed on http://en.wikipedia.org/wiki/Jenkins_hash_function - like - SPOOKY???
23 *
24 *
25 */
26
27namespace Stroika::Foundation::Cryptography::Digest::Algorithm {
28
29 /**
30 * Algorithm 'type tag' indicating this particular algorithm.
31 */
32 struct Jenkins {};
33
34 /**
35 * Traits for the Jenkins algorithm.
36 */
37 template <>
39 using ReturnType = uint32_t;
40 };
41
42 /**
43 * \brief Windowing digester (code to do the digest algorithm) for the Jenkins algorithm.
44 */
45 template <>
46 class DigesterAlgorithm<Jenkins> : public IDigestAlgorithm<DigesterDefaultTraitsForAlgorithm<Jenkins>::ReturnType> {
47 public:
49
50 public:
51 DigesterAlgorithm () = default;
52 DigesterAlgorithm (const DigesterAlgorithm& src) = default;
53
54 public:
55 nonvirtual DigesterAlgorithm& operator= (const DigesterAlgorithm& rhs) = default;
56
57 public:
58 virtual void Write (const byte* start, const byte* end) override;
59
60 public:
61 virtual ReturnType Complete () override;
62
63 private:
64 uint32_t fData_{0};
65#if qStroika_Foundation_Debug_AssertionsChecked
66 bool fCompleted_{false};
67#endif
68 };
69
70}
71
72/*
73 ********************************************************************************
74 ***************************** Implementation Details ***************************
75 ********************************************************************************
76 */
77#include "Jenkins.inl"
78
79#endif /*_Stroika_Foundation_Cryptography_Digest_Jenkins_h_*/
DigesterAlgorithm is specialized for each algorithm; generally don't use this directly,...
Definition Algorithm.h:55