diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-06-04 08:04:16 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-06-04 08:05:01 +0800 |
commit | 31a258458be39f4e6c147974c87b7fab15223eb7 (patch) | |
tree | 61599542d4342585af4300b5345af48f6d61550a /test/compilationTests/stringutils | |
parent | acd87063097636b8b1a007c69f25887b56058306 (diff) | |
download | dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.tar dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.tar.gz dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.tar.bz2 dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.tar.lz dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.tar.xz dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.tar.zst dexon-solidity-31a258458be39f4e6c147974c87b7fab15223eb7.zip |
Update imported stringutils to use keccak256
Diffstat (limited to 'test/compilationTests/stringutils')
-rw-r--r-- | test/compilationTests/stringutils/strings.sol | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/compilationTests/stringutils/strings.sol b/test/compilationTests/stringutils/strings.sol index 0a2d68bd..771f7a53 100644 --- a/test/compilationTests/stringutils/strings.sol +++ b/test/compilationTests/stringutils/strings.sol @@ -339,7 +339,7 @@ library strings { */ function keccak(slice self) internal returns (bytes32 ret) { assembly { - ret := sha3(mload(add(self, 32)), mload(self)) + ret := keccak256(mload(add(self, 32)), mload(self)) } } @@ -363,7 +363,7 @@ library strings { let len := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) - equal := eq(sha3(selfptr, len), sha3(needleptr, len)) + equal := eq(keccak256(selfptr, len), keccak256(needleptr, len)) } return equal; } @@ -386,7 +386,7 @@ library strings { let len := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) - equal := eq(sha3(selfptr, len), sha3(needleptr, len)) + equal := eq(keccak256(selfptr, len), keccak256(needleptr, len)) } } @@ -419,7 +419,7 @@ library strings { assembly { let len := mload(needle) let needleptr := mload(add(needle, 0x20)) - equal := eq(sha3(selfptr, len), sha3(needleptr, len)) + equal := eq(keccak256(selfptr, len), keccak256(needleptr, len)) } return equal; @@ -443,7 +443,7 @@ library strings { assembly { let len := mload(needle) let needleptr := mload(add(needle, 0x20)) - equal := eq(sha3(selfptr, len), sha3(needleptr, len)) + equal := eq(keccak256(selfptr, len), keccak256(needleptr, len)) } } @@ -479,11 +479,11 @@ library strings { } else { // For long needles, use hashing bytes32 hash; - assembly { hash := sha3(needleptr, needlelen) } + assembly { hash := keccak256(needleptr, needlelen) } ptr = selfptr; for (idx = 0; idx <= selflen - needlelen; idx++) { bytes32 testHash; - assembly { testHash := sha3(ptr, needlelen) } + assembly { testHash := keccak256(ptr, needlelen) } if (hash == testHash) return ptr; ptr += 1; @@ -519,11 +519,11 @@ library strings { } else { // For long needles, use hashing bytes32 hash; - assembly { hash := sha3(needleptr, needlelen) } + assembly { hash := keccak256(needleptr, needlelen) } ptr = selfptr + (selflen - needlelen); while (ptr >= selfptr) { bytes32 testHash; - assembly { testHash := sha3(ptr, needlelen) } + assembly { testHash := keccak256(ptr, needlelen) } if (hash == testHash) return ptr + needlelen; ptr -= 1; |