aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm
diff options
context:
space:
mode:
authorRicardo Catalinas Jiménez <r@untroubled.be>2016-02-22 02:40:27 +0800
committerRicardo Catalinas Jiménez <r@untroubled.be>2016-02-22 06:34:34 +0800
commit436fc8d76a4871d67a61dc86c1a635e20594a0e6 (patch)
tree5fad9f69b068f43ca606e2887f5522188e7f9ddd /core/vm
parentc20d6e5e4ed8eff6d26cd849f90ca42dd5a7040c (diff)
downloadgo-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar
go-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.gz
go-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.bz2
go-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.lz
go-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.xz
go-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.zst
go-tangerine-436fc8d76a4871d67a61dc86c1a635e20594a0e6.zip
all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()
As we aren't really using the standarized SHA-3
Diffstat (limited to 'core/vm')
-rw-r--r--core/vm/contracts.go2
-rw-r--r--core/vm/instructions.go2
-rw-r--r--core/vm/jit.go2
-rw-r--r--core/vm/jit_test.go2
-rw-r--r--core/vm/runtime/runtime.go2
-rw-r--r--core/vm/vm.go2
-rw-r--r--core/vm/vm_jit.go4
7 files changed, 8 insertions, 8 deletions
diff --git a/core/vm/contracts.go b/core/vm/contracts.go
index f204432a2..5cc9f903b 100644
--- a/core/vm/contracts.go
+++ b/core/vm/contracts.go
@@ -111,7 +111,7 @@ func ecrecoverFunc(in []byte) []byte {
}
// the first byte of pubkey is bitcoin heritage
- return common.LeftPadBytes(crypto.Sha3(pubKey[1:])[12:], 32)
+ return common.LeftPadBytes(crypto.Keccak256(pubKey[1:])[12:], 32)
}
func memCpy(in []byte) []byte {
diff --git a/core/vm/instructions.go b/core/vm/instructions.go
index 26f7671ff..1e1086b13 100644
--- a/core/vm/instructions.go
+++ b/core/vm/instructions.go
@@ -316,7 +316,7 @@ func opMulmod(instr instruction, pc *uint64, env Environment, contract *Contract
func opSha3(instr instruction, pc *uint64, env Environment, contract *Contract, memory *Memory, stack *stack) {
offset, size := stack.pop(), stack.pop()
- hash := crypto.Sha3(memory.Get(offset.Int64(), size.Int64()))
+ hash := crypto.Keccak256(memory.Get(offset.Int64(), size.Int64()))
stack.push(common.BytesToBig(hash))
}
diff --git a/core/vm/jit.go b/core/vm/jit.go
index 504aab523..5404730c1 100644
--- a/core/vm/jit.go
+++ b/core/vm/jit.go
@@ -96,7 +96,7 @@ type Program struct {
// NewProgram returns a new JIT program
func NewProgram(code []byte) *Program {
program := &Program{
- Id: crypto.Sha3Hash(code),
+ Id: crypto.Keccak256Hash(code),
mapping: make(map[uint64]uint64),
destinations: make(map[uint64]struct{}),
code: code,
diff --git a/core/vm/jit_test.go b/core/vm/jit_test.go
index e8e078a46..4174c666f 100644
--- a/core/vm/jit_test.go
+++ b/core/vm/jit_test.go
@@ -189,7 +189,7 @@ func (self *Env) Db() Database { return nil }
func (self *Env) GasLimit() *big.Int { return self.gasLimit }
func (self *Env) VmType() Type { return StdVmTy }
func (self *Env) GetHash(n uint64) common.Hash {
- return common.BytesToHash(crypto.Sha3([]byte(big.NewInt(int64(n)).String())))
+ return common.BytesToHash(crypto.Keccak256([]byte(big.NewInt(int64(n)).String())))
}
func (self *Env) AddLog(log *Log) {
}
diff --git a/core/vm/runtime/runtime.go b/core/vm/runtime/runtime.go
index 1fa06e980..565ce7b73 100644
--- a/core/vm/runtime/runtime.go
+++ b/core/vm/runtime/runtime.go
@@ -67,7 +67,7 @@ func setDefaults(cfg *Config) {
}
if cfg.GetHashFn == nil {
cfg.GetHashFn = func(n uint64) common.Hash {
- return common.BytesToHash(crypto.Sha3([]byte(new(big.Int).SetUint64(n).String())))
+ return common.BytesToHash(crypto.Keccak256([]byte(new(big.Int).SetUint64(n).String())))
}
}
}
diff --git a/core/vm/vm.go b/core/vm/vm.go
index 320135ff2..d45d136b5 100644
--- a/core/vm/vm.go
+++ b/core/vm/vm.go
@@ -58,7 +58,7 @@ func (self *Vm) Run(contract *Contract, input []byte) (ret []byte, err error) {
}
var (
- codehash = crypto.Sha3Hash(contract.Code) // codehash is used when doing jump dest caching
+ codehash = crypto.Keccak256Hash(contract.Code) // codehash is used when doing jump dest caching
program *Program
)
if EnableJit {
diff --git a/core/vm/vm_jit.go b/core/vm/vm_jit.go
index 07cb52d4a..589c30fa8 100644
--- a/core/vm/vm_jit.go
+++ b/core/vm/vm_jit.go
@@ -200,7 +200,7 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
self.data.timestamp = self.env.Time()
self.data.code = getDataPtr(code)
self.data.codeSize = uint64(len(code))
- self.data.codeHash = hash2llvm(crypto.Sha3(code)) // TODO: Get already computed hash?
+ self.data.codeHash = hash2llvm(crypto.Keccak256(code)) // TODO: Get already computed hash?
jit := C.evmjit_create()
retCode := C.evmjit_run(jit, unsafe.Pointer(&self.data), unsafe.Pointer(self))
@@ -242,7 +242,7 @@ func (self *JitVm) Env() Environment {
//export env_sha3
func env_sha3(dataPtr *byte, length uint64, resultPtr unsafe.Pointer) {
data := llvm2bytesRef(dataPtr, length)
- hash := crypto.Sha3(data)
+ hash := crypto.Keccak256(data)
result := (*i256)(resultPtr)
*result = hash2llvm(hash)
}