1
0
Fork 0
forked from lthn/blockchain

changed progpow cpu implementation

This commit is contained in:
crypro.zoidberg 2019-03-28 22:07:55 +01:00
parent 17dc3c6059
commit 7c4a65ef2a
6 changed files with 39 additions and 9 deletions

View file

@ -19,6 +19,12 @@
extern "C" {
#endif
/**
* The Ethash algorithm revision implemented as specified in the Ethash spec
* https://github.com/ethereum/wiki/wiki/Ethash.
*/
#define ETHASH_REVISION "23"
#define ETHASH_EPOCH_LENGTH 30000
#define ETHASH_LIGHT_CACHE_ITEM_SIZE 64
#define ETHASH_FULL_DATASET_ITEM_SIZE 128

View file

@ -14,16 +14,17 @@
#pragma once
#include <ethash/ethash.h>
#include <ethash/hash_types.hpp>
#include <cstdint>
#include <cstring>
#include <memory>
#include "ethash/ethash.h"
#include "ethash/hash_types.hpp"
namespace ethash
{
constexpr auto revision = ETHASH_REVISION;
static constexpr int epoch_length = ETHASH_EPOCH_LENGTH;
static constexpr int light_cache_item_size = ETHASH_LIGHT_CACHE_ITEM_SIZE;
static constexpr int full_dataset_item_size = ETHASH_FULL_DATASET_ITEM_SIZE;

View file

@ -4,7 +4,7 @@
#pragma once
#include "ethash/hash_types.h"
#include <ethash/hash_types.h>
namespace ethash
{

View file

@ -14,11 +14,16 @@ namespace progpow
{
using namespace ethash; // Include ethash namespace.
constexpr int period_length = 10;
/// The ProgPoW algorithm revision implemented as specified in the spec
/// https://github.com/ifdefelse/ProgPOW#change-history.
constexpr auto revision = "0.9.2";
constexpr int period_length = 50;
constexpr uint32_t num_regs = 32;
constexpr size_t num_lanes = 16;
constexpr int num_cache_accesses = 11;
constexpr int num_math_operations = 18;
constexpr int num_cache_accesses = 12;
constexpr int num_math_operations = 20;
constexpr size_t l1_cache_size = 16 * 1024;
constexpr size_t l1_cache_num_items = l1_cache_size / sizeof(uint32_t);

View file

@ -0,0 +1,18 @@
/* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
* Copyright 2019 Pawel Bylica.
* Licensed under the Apache License, Version 2.0.
*/
#pragma once
/** The ethash library version. */
#define ETHASH_VERSION "0.5.0-alpha.0"
#ifdef __cplusplus
namespace ethash
{
/// The ethash library version.
constexpr auto version = ETHASH_VERSION;
} // namespace ethash
#endif

View file

@ -95,7 +95,7 @@ mix_rng_state::mix_rng_state(uint64_t seed) noexcept
rng = kiss99{z, w, jsr, jcong};
// Create random permutations of mix destinations / sources.
// Uses FisherYates shuffle.
// Uses Fisher-Yates shuffle.
for (uint32_t i = 0; i < num_regs; ++i)
{
dst_seq[i] = i;