From 7b4737c87805b464cd47d01a9d814df5e41b8255 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sat, 26 Apr 2014 19:26:34 +0200 Subject: Switch script.cpp and hash.cpp to use sha2.cpp instead of OpenSSL. --- src/script.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/script.cpp') diff --git a/src/script.cpp b/src/script.cpp index 11cdfef95..f20c0bcca 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -9,10 +9,13 @@ #include "hash.h" #include "key.h" #include "keystore.h" +#include "sha2.h" #include "sync.h" #include "uint256.h" #include "util.h" +#include + #include #include #include @@ -805,17 +808,11 @@ bool EvalScript(vector >& stack, const CScript& script, co else if (opcode == OP_SHA1) SHA1(&vch[0], vch.size(), &vchHash[0]); else if (opcode == OP_SHA256) - SHA256(&vch[0], vch.size(), &vchHash[0]); + CSHA256().Write(&vch[0], vch.size()).Finalize(&vchHash[0]); else if (opcode == OP_HASH160) - { - uint160 hash160 = Hash160(vch); - memcpy(&vchHash[0], &hash160, sizeof(hash160)); - } + CHash160().Write(&vch[0], vch.size()).Finalize(&vchHash[0]); else if (opcode == OP_HASH256) - { - uint256 hash = Hash(vch.begin(), vch.end()); - memcpy(&vchHash[0], &hash, sizeof(hash)); - } + CHash256().Write(&vch[0], vch.size()).Finalize(&vchHash[0]); popstack(stack); stack.push_back(vchHash); } -- cgit v1.2.3