rename sha3_32 => sha3_256

pull/7/head
yann300 8 years ago
parent 6c20c60bae
commit 427801ec55
  1. 2
      src/helpers/util.js
  2. 2
      src/solidity/types/ArrayType.js
  3. 2
      src/solidity/types/DynamicByteArray.js
  4. 2
      src/storage/storageViewer.js
  5. 2
      src/trace/traceCache.js
  6. 4
      test/solidity/mockStorageResolver.js

@ -125,7 +125,7 @@ module.exports = {
* @param {String} value - value to sha3
* @return {Object} - return sha3ied value
*/
sha3_32: function (value) {
sha3_256: function (value) {
var ret = ethutil.bufferToHex(ethutil.setLengthLeft(value, 32))
ret = ethutil.sha3(ret)
return ethutil.bufferToHex(ret)

@ -43,7 +43,7 @@ class ArrayType extends RefType {
}
if (this.arraySize === 'dynamic') {
size = util.toBN('0x' + slotValue)
currentLocation.slot = helper.sha3_32(location.slot)
currentLocation.slot = helper.sha3_256(location.slot)
} else {
size = new BN(this.arraySize)
}

@ -23,7 +23,7 @@ class DynamicByteArray extends RefType {
var bn = new BN(value, 16)
if (bn.testn(0)) {
var length = bn.div(new BN(2))
var dataPos = new BN(helper.sha3_32(location.slot).replace('0x', ''), 16)
var dataPos = new BN(helper.sha3_256(location.slot).replace('0x', ''), 16)
var ret = ''
var currentSlot = '0x'
try {

@ -30,7 +30,7 @@ class StorageViewer {
* @param {Function} - callback - {key, hashedKey, value} -
*/
storageSlot (slot, callback) {
var hashed = helper.sha3_32(slot)
var hashed = helper.sha3_256(slot)
this.storageResolver.storageSlot(hashed, this.context.tx, this.context.stepIndex, this.storageChanges, this.context.address, (error, result) => {
if (error) {
callback(error)

@ -87,7 +87,7 @@ TraceCache.prototype.pushStoreChanges = function (index, address, key, value) {
'address': address,
'key': key,
'value': value,
'hashedKey': helper.sha3_32(key)
'hashedKey': helper.sha3_256(key)
}
this.storageChanges.push(index)
}

@ -5,7 +5,7 @@ class MockStorageResolver {
constructor (_storage) {
this.storage = {}
for (var k in _storage) {
var hashed = util.sha3_32(k)
var hashed = util.sha3_256(k)
this.storage[hashed] = {
hashed: hashed,
key: k,
@ -19,7 +19,7 @@ class MockStorageResolver {
}
storageSlot (slot, callback) {
var hashed = util.sha3_32(slot)
var hashed = util.sha3_256(slot)
callback(null, this.storage[hashed])
}

Loading…
Cancel
Save