KiCad PCB EDA Suite
Loading...
Searching...
No Matches
hash_128.h
Go to the documentation of this file.
1
/*
2
* This program source code file is part of KiCad, a free EDA CAD application.
3
*
4
* Copyright (C) 2024 Alex Shvartzkop <
[email protected]
>
5
* Copyright (C) 2024 Kicad Developers, see AUTHORS.txt for contributors.
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, you may find one here:
19
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20
* or you may search the http://www.gnu.org website for the version 2 license,
21
* or you may write to the Free Software Foundation, Inc.,
22
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23
*/
24
25
#ifndef HASH_128_H_
26
#define HASH_128_H_
27
28
#include <cstdint>
29
#include <iomanip>
30
#include <sstream>
31
35
struct
HASH_128
36
{
37
void
Clear
()
38
{
39
memset(
Value64
, 0,
sizeof
(
Value64
) );
//
40
}
41
42
bool
operator==
(
const
HASH_128
& aOther )
const
43
{
44
return
memcmp(
Value64
, aOther.
Value64
,
sizeof
(
Value64
) ) == 0;
45
}
46
47
std::string
ToString
()
const
48
{
49
std::stringstream ss;
50
ss << std::hex << std::uppercase << std::setfill(
'0'
)
51
<< std::setw( 16 ) <<
Value64
[0]
52
<< std::setw( 16 ) <<
Value64
[1];
53
return
ss.str();
54
}
55
56
public
:
57
union
58
{
59
uint8_t
Value8
[16]{};
// Zero-initialized
60
uint32_t
Value32
[4];
61
uint64_t
Value64
[2];
62
};
63
};
64
65
#endif
// HASH_128_H_
HASH_128
A storage class for 128-bit hash value.
Definition:
hash_128.h:36
HASH_128::Clear
void Clear()
Definition:
hash_128.h:37
HASH_128::Value32
uint32_t Value32[4]
Definition:
hash_128.h:60
HASH_128::operator==
bool operator==(const HASH_128 &aOther) const
Definition:
hash_128.h:42
HASH_128::Value8
uint8_t Value8[16]
Definition:
hash_128.h:59
HASH_128::ToString
std::string ToString() const
Definition:
hash_128.h:47
HASH_128::Value64
uint64_t Value64[2]
Definition:
hash_128.h:61
src
libs
kimath
include
hash_128.h
Generated on Thu Nov 21 2024 00:06:44 for KiCad PCB EDA Suite by
1.9.6