aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-25 06:36:07 +0800
committerchriseth <c@ethdev.com>2017-01-25 06:37:48 +0800
commit3949624a61b1dd0c32e67d30fe7d46b2511c583f (patch)
tree796125372166adcc3207927650666186f32edbd8 /libsolidity/ast
parent605455f96b64f0c4b229cc31186f2dcf22433e6d (diff)
downloaddexon-solidity-3949624a61b1dd0c32e67d30fe7d46b2511c583f.tar.gz
dexon-solidity-3949624a61b1dd0c32e67d30fe7d46b2511c583f.tar.zst
dexon-solidity-3949624a61b1dd0c32e67d30fe7d46b2511c583f.zip
Also check library addresses.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/AST.cpp22
1 files changed, 1 insertions, 21 deletions
diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp
index e2b50dd7..616de54e 100644
--- a/libsolidity/ast/AST.cpp
+++ b/libsolidity/ast/AST.cpp
@@ -539,25 +539,5 @@ bool Literal::passesAddressChecksum() const
{
string lit = value();
solAssert(lit.substr(0, 2) == "0x", "Expected hex prefix");
- lit = lit.substr(2);
-
- if (lit.length() != 40)
- return false;
-
- h256 hash = keccak256(boost::algorithm::to_lower_copy(lit, std::locale::classic()));
- for (size_t i = 0; i < 40; ++i)
- {
- char addressCharacter = lit[i];
- bool lowerCase;
- if ('a' <= addressCharacter && addressCharacter <= 'f')
- lowerCase = true;
- else if ('A' <= addressCharacter && addressCharacter <= 'F')
- lowerCase = false;
- else
- continue;
- unsigned nibble = (unsigned(hash[i / 2]) >> (4 * (1 - (i % 2)))) & 0xf;
- if ((nibble >= 8) == lowerCase)
- return false;
- }
- return true;
+ return dev::passesAddressChecksum(lit, true);
}