// Copyright (c) 2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_TEST_GEN_CRYPTO_GEN_H #define BITCOIN_TEST_GEN_CRYPTO_GEN_H #include #include #include #include #include #include #include /** Generates 1 to 15 keys for OP_CHECKMULTISIG */ rc::Gen> MultisigKeys(); namespace rc { /** Generator for a new CKey */ template <> struct Arbitrary { static Gen arbitrary() { return rc::gen::map([](int x) { CKey key; key.MakeNewKey(true); return key; }); }; }; /** Generator for a CPrivKey */ template <> struct Arbitrary { static Gen arbitrary() { return gen::map(gen::arbitrary(), [](const CKey& key) { return key.GetPrivKey(); }); }; }; /** Generator for a new CPubKey */ template <> struct Arbitrary { static Gen arbitrary() { return gen::map(gen::arbitrary(), [](const CKey& key) { return key.GetPubKey(); }); }; }; /** Generates a arbitrary uint256 */ template <> struct Arbitrary { static Gen arbitrary() { return rc::gen::just(GetRandHash()); }; }; } //namespace rc #endif