Registry Mirror
搜索
Skip to content
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Files
Expand file tree
master
Breadcrumbs
elements
/
src
/
test
/
fuzz
/
key_io.cpp
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
39 lines (32 loc) · 1.09 KB
master
Breadcrumbs
elements
/
src
/
test
/
fuzz
/
key_io.cpp
Copy path
Top
File metadata and controls
Code
Blame
39 lines (32 loc) · 1.09 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) 2020-2021 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chainparams.h>
#include <key_io.h>
#include <test/fuzz/fuzz.h>
#include <util/chaintype.h>
#include <cassert>
#include <cstdint>
#include <string>
#include <vector>
void initialize_key_io()
{
static ECC_Context ecc_context{};
SelectParams(ChainType::MAIN);
}
FUZZ_TARGET(key_io, .init = initialize_key_io)
{
const std::string random_string(buffer.begin(), buffer.end());
const CKey key = DecodeSecret(random_string);
if (key.IsValid()) {
assert(key == DecodeSecret(EncodeSecret(key)));
}
const CExtKey ext_key = DecodeExtKey(random_string);
if (ext_key.key.size() == 32) {
assert(ext_key == DecodeExtKey(EncodeExtKey(ext_key)));
}
const CExtPubKey ext_pub_key = DecodeExtPubKey(random_string);
if (ext_pub_key.pubkey.size() == CPubKey::COMPRESSED_SIZE) {
assert(ext_pub_key == DecodeExtPubKey(EncodeExtPubKey(ext_pub_key)));
}
}
You can’t perform that action at this time.