/
githubmirror
/
bitcoin
Обзор
Документация
Войти
/
githubmirror
/
bitcoin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/fuzz/key_io.cpp
39 строк
1 KB
MarcoFalke
scripted-diff: [doc] Unify stale copyright headers
17 дек 2025, 00:21
17 дек 2025, 00:21
fa5f297
Код
Авторство
О чём код?
// Copyright (c) 2020-present 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))); } }