Last active
September 19, 2017 12:09
-
-
Save simform-solutions/ef2c9ed7c053bd2d4966a78c564e3404 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Takes a address (81 Characters) and converts it to an address with checksum (90 Characters) | |
def address_checksum(address): | |
bytes_address = bytes(address) | |
addy = Address(bytes_address) | |
address = str(addy.with_valid_checksum()) | |
return address | |
# Takes an address with checksum and verifies if the address matches with the checksum | |
def is_valid_address(address_with_checksum): | |
address = address_with_checksum[:81] | |
new_address_with_checksum = address_checksum(address) | |
if new_address_with_checksum == address_with_checksum: | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment