0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-18 11:57:37 -05:00
bitcoin-bitcoin-core/src/bench/xor.cpp

24 lines
604 B
C++

// Copyright (c) The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://opensource.org/license/mit/.
#include <bench/bench.h>
#include <random.h>
#include <streams.h>
#include <cstddef>
#include <vector>
static void Xor(benchmark::Bench& bench)
{
FastRandomContext frc{/*fDeterministic=*/true};
auto data{frc.randbytes<std::byte>(1024)};
auto key{frc.randbytes<std::byte>(31)};
bench.batch(data.size()).unit("byte").run([&] {
util::Xor(data, key);
});
}
BENCHMARK(Xor, benchmark::PriorityLevel::HIGH);