Commit 075fa4ee authored by yann300's avatar yann300

fix sha3 input extract

parent ce3caa69
...@@ -213,11 +213,16 @@ function getSha3Input (stack, memory) { ...@@ -213,11 +213,16 @@ function getSha3Input (stack, memory) {
var memLengthDec = (new ethutil.BN(memoryLength.replace('0x', ''), 16).toString(10)) var memLengthDec = (new ethutil.BN(memoryLength.replace('0x', ''), 16).toString(10))
memoryLength = parseInt(memLengthDec) * 2 memoryLength = parseInt(memLengthDec) * 2
var subMemoryIndex = Math.floor(memoryStart / 32) var min = Math.floor(memoryStart / 32)
var sha3Input = '' var fillLength = Math.floor(memoryLength / 32)
while (sha3Input.length < memoryLength) { var sha3Input = memory[min].slice(memoryStart - 32 * min)
sha3Input += memory[subMemoryIndex] min++
subMemoryIndex++ while (min < fillLength) {
sha3Input += memory[min]
min++
}
if (sha3Input.length < memoryLength) {
sha3Input += memory[min].slice(0, memoryLength - sha3Input.length)
} }
return sha3Input return sha3Input
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment