mirror of
https://github.com/jwinterm/myriadcoin.git
synced 2026-11-13 09:03:59 +01:00
Myriadcoin 0.11 port
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
||||
// Copyright (c) 2009-2014 The Bitcoin developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "primitives/pureheader.h"
|
||||
|
||||
#include "chainparams.h"
|
||||
#include "crypto/hashgroestl.h"
|
||||
#include "crypto/hashqubit.h"
|
||||
#include "crypto/hashskein.h"
|
||||
#include "crypto/scrypt.h"
|
||||
#include "hash.h"
|
||||
#include "utilstrencodings.h"
|
||||
|
||||
uint256 CPureBlockHeader::GetHash() const
|
||||
{
|
||||
return SerializeHash(*this);
|
||||
}
|
||||
|
||||
uint256 CPureBlockHeader::GetPoWHash(int algo) const
|
||||
{
|
||||
switch(algo)
|
||||
{
|
||||
case ALGO_SHA256D:
|
||||
return GetHash();
|
||||
case ALGO_SCRYPT:
|
||||
{
|
||||
uint256 thash;
|
||||
scrypt_1024_1_1_256(BEGIN(nVersion), BEGIN(thash));
|
||||
return thash;
|
||||
}
|
||||
case ALGO_GROESTL:
|
||||
return HashGroestl(BEGIN(nVersion), END(nNonce));
|
||||
case ALGO_SKEIN:
|
||||
return HashSkein(BEGIN(nVersion), END(nNonce));
|
||||
case ALGO_QUBIT:
|
||||
return HashQubit(BEGIN(nVersion), END(nNonce));
|
||||
}
|
||||
return GetHash();
|
||||
}
|
||||
|
||||
int GetAlgo(int nVersion)
|
||||
{
|
||||
switch (nVersion & BLOCK_VERSION_ALGO)
|
||||
{
|
||||
case 0:
|
||||
return ALGO_SHA256D;
|
||||
case BLOCK_VERSION_SCRYPT:
|
||||
return ALGO_SCRYPT;
|
||||
case BLOCK_VERSION_GROESTL:
|
||||
return ALGO_GROESTL;
|
||||
case BLOCK_VERSION_SKEIN:
|
||||
return ALGO_SKEIN;
|
||||
case BLOCK_VERSION_QUBIT:
|
||||
return ALGO_QUBIT;
|
||||
}
|
||||
return ALGO_SHA256D;
|
||||
}
|
||||
|
||||
std::string GetAlgoName(int Algo)
|
||||
{
|
||||
switch (Algo)
|
||||
{
|
||||
case ALGO_SHA256D:
|
||||
return std::string("sha256d");
|
||||
case ALGO_SCRYPT:
|
||||
return std::string("scrypt");
|
||||
case ALGO_GROESTL:
|
||||
return std::string("groestl");
|
||||
case ALGO_SKEIN:
|
||||
return std::string("skein");
|
||||
case ALGO_QUBIT:
|
||||
return std::string("qubit");
|
||||
}
|
||||
return std::string("unknown");
|
||||
}
|
||||
Reference in New Issue
Block a user