Browse Source

replace OP_SHA256 by OP_GOST3411

pull/5/head
orignal 8 years ago
parent
commit
787ebbc8ad
  1. 9
      src/script.cpp
  2. 2
      src/script.h

9
src/script.cpp

@ -15,6 +15,7 @@ using namespace boost;
#include "main.h" #include "main.h"
#include "sync.h" #include "sync.h"
#include "util.h" #include "util.h"
#include "Gost.h"
bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubKey, const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType, int flags); bool CheckSig(vector<unsigned char> vchSig, const vector<unsigned char> &vchPubKey, const CScript &scriptCode, const CTransaction& txTo, unsigned int nIn, int nHashType, int flags);
@ -194,7 +195,7 @@ const char* GetOpName(opcodetype opcode)
// crypto // crypto
case OP_RIPEMD160 : return "OP_RIPEMD160"; case OP_RIPEMD160 : return "OP_RIPEMD160";
case OP_SHA1 : return "OP_SHA1"; case OP_SHA1 : return "OP_SHA1";
case OP_SHA256 : return "OP_SHA256"; case OP_GOST3411 : return "OP_GOST3411";
case OP_HASH160 : return "OP_HASH160"; case OP_HASH160 : return "OP_HASH160";
case OP_HASH256 : return "OP_HASH256"; case OP_HASH256 : return "OP_HASH256";
case OP_CODESEPARATOR : return "OP_CODESEPARATOR"; case OP_CODESEPARATOR : return "OP_CODESEPARATOR";
@ -784,7 +785,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
// //
case OP_RIPEMD160: case OP_RIPEMD160:
case OP_SHA1: case OP_SHA1:
case OP_SHA256: case OP_GOST3411:
case OP_HASH160: case OP_HASH160:
case OP_HASH256: case OP_HASH256:
{ {
@ -797,8 +798,8 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, co
RIPEMD160(&vch[0], vch.size(), &vchHash[0]); RIPEMD160(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_SHA1) else if (opcode == OP_SHA1)
SHA1(&vch[0], vch.size(), &vchHash[0]); SHA1(&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_SHA256) else if (opcode == OP_GOST3411)
SHA256(&vch[0], vch.size(), &vchHash[0]); i2p::crypto::GOSTR3411_2012_256 (&vch[0], vch.size(), &vchHash[0]);
else if (opcode == OP_HASH160) else if (opcode == OP_HASH160)
{ {
uint160 hash160 = Hash160(vch); uint160 hash160 = Hash160(vch);

2
src/script.h

@ -177,7 +177,7 @@ enum opcodetype
// crypto // crypto
OP_RIPEMD160 = 0xa6, OP_RIPEMD160 = 0xa6,
OP_SHA1 = 0xa7, OP_SHA1 = 0xa7,
OP_SHA256 = 0xa8, OP_GOST3411 = 0xa8,
OP_HASH160 = 0xa9, OP_HASH160 = 0xa9,
OP_HASH256 = 0xaa, OP_HASH256 = 0xaa,
OP_CODESEPARATOR = 0xab, OP_CODESEPARATOR = 0xab,

Loading…
Cancel
Save