Skip to content

Commit 04d9b8b

Browse files
committed
check length in checksum validation
1 parent 8f2e253 commit 04d9b8b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

validators/crypto_addresses/eth_address.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def _validate_eth_checksum_address(addr: str):
1515
addr = addr.replace("0x", "")
1616
addr_hash = keccak_256(addr.lower().encode("ascii")).hexdigest()
1717

18+
if len(addr) != 40:
19+
return False
20+
1821
for i in range(0, 40):
1922
if ((int(addr_hash[i], 16) > 7 and addr[i].upper() != addr[i]) or
2023
(int(addr_hash[i], 16) <= 7 and addr[i].lower() != addr[i])):

0 commit comments

Comments
 (0)