Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
uint256.cpp
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-present The Bitcoin Core developers
3
// Distributed under the MIT software license, see the accompanying
4
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6
#include <
uint256.h
>
7
8
#include <
util/strencodings.h
>
9
10
template
<
unsigned
int
BITS>
11
std::string
base_blob<BITS>::GetHex
()
const
12
{
13
uint8_t m_data_rev[
WIDTH
];
14
for
(
int
i = 0; i <
WIDTH
; ++i) {
15
m_data_rev[i] =
m_data
[
WIDTH
- 1 - i];
16
}
17
return
HexStr
(m_data_rev);
18
}
19
20
template
<
unsigned
int
BITS>
21
std::string
base_blob<BITS>::ToString
()
const
22
{
23
return
(
GetHex
());
24
}
25
26
// Explicit instantiations for base_blob<160>
27
template
std::string
base_blob<160>::GetHex
()
const
;
28
template
std::string
base_blob<160>::ToString
()
const
;
29
30
// Explicit instantiations for base_blob<256>
31
template
std::string
base_blob<256>::GetHex
()
const
;
32
template
std::string
base_blob<256>::ToString
()
const
;
33
34
const
uint256
uint256::ZERO
(0);
35
const
uint256
uint256::ONE
(1);
base_blob::GetHex
std::string GetHex() const
Definition
uint256.cpp:11
base_blob::WIDTH
static constexpr int WIDTH
Definition
uint256.h:28
base_blob::ToString
std::string ToString() const
Definition
uint256.cpp:21
base_blob::m_data
std::array< uint8_t, WIDTH > m_data
Definition
uint256.h:30
uint256
256-bit opaque blob.
Definition
uint256.h:195
uint256::ONE
static const uint256 ONE
Definition
uint256.h:204
uint256::ZERO
static const uint256 ZERO
Definition
uint256.h:203
HexStr
std::string HexStr(const std::span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
Definition
hex_base.cpp:30
strencodings.h
uint256.h
Generated on
for Bitcoin Core by
1.17.0