1 // ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 // Copyright 2018 Pawel Bylica.
3 // Licensed under the Apache License, Version 2.0. See the LICENSE file.
4 
5 /// @file
6 ///
7 /// ProgPoW API
8 ///
9 /// This file provides the public API for ProgPoW as the Ethash API extension.
10 
11 #include <ethash/ethash.hpp>
12 
13 namespace progpow
14 {
15 using namespace ethash;  // Include ethash namespace.
16 
17 constexpr int period_length = 50;
18 constexpr uint32_t num_regs = 32;
19 constexpr size_t num_lanes = 16;
20 constexpr int num_cache_accesses = 12;
21 constexpr int num_math_operations = 20;
22 constexpr size_t l1_cache_size = 16 * 1024;
23 constexpr size_t l1_cache_num_items = l1_cache_size / sizeof(uint32_t);
24 
25 result hash(const epoch_context& context, int block_number, const hash256& header_hash,
26     uint64_t nonce) noexcept;
27 
28 result hash(const epoch_context_full& context, int block_number, const hash256& header_hash,
29     uint64_t nonce) noexcept;
30 
31 bool verify(const epoch_context& context, int block_number, const hash256& header_hash,
32     const hash256& mix_hash, uint64_t nonce, const hash256& boundary) noexcept;
33 
34 search_result search_light(const epoch_context& context, int block_number,
35     const hash256& header_hash, const hash256& boundary, uint64_t start_nonce,
36     size_t iterations) noexcept;
37 
38 search_result search(const epoch_context_full& context, int block_number,
39     const hash256& header_hash, const hash256& boundary, uint64_t start_nonce,
40     size_t iterations) noexcept;
41 
42 }  // namespace progpow
43