Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ notifications:
on_success: never
on_failure: always

install: pip install -r requirements.txt
install: python3 setup.py install

before_script: pip install pytest

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ A cryptocurrency address inspection/validation library for python.
* zcash

## Installation
From `setup.py`:
```commandline
python setup.py install
```
Pip:
```shell
pip3 install coinaddrng
```
Expand Down
2 changes: 1 addition & 1 deletion coinaddrng/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
:license: MIT, see LICENSE for more details.
"""

__version__ = '1.0.30'
__version__ = '1.1.0'

from . import interfaces, currency, validation
from .validation import validate
Expand Down
27 changes: 7 additions & 20 deletions coinaddrng/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

from zope.interface import implementer, provider
import attr
import sha3
import base58check
from Crypto.Hash import keccak
import math
from binascii import unhexlify, crc32
import base64
Expand Down Expand Up @@ -510,34 +510,21 @@ def validate(self):

# Ethereum address is generated by keccak algorithm and has to
# hexadecimal
addr_hash = sha3.keccak_256(addr.lower().encode('ascii')).hexdigest()
kh = keccak.new(digest_bits=256)
kh.update(addr.lower().encode('ascii'))
addr_hash = kh.hexdigest()

for i, letter in enumerate(addr):
if any([
int(addr_hash[i], 16) >= 8 and letter.upper() != letter,
int(addr_hash[i], 16) < 8 and letter.lower() != letter
int(addr_hash[i], 16) >= 8 and letter.upper() != letter,
int(addr_hash[i], 16) < 8 and letter.lower() != letter
]):
return False
return True

def validate_extended(self):
return False

#def validate(self):
# """Validate the address."""
# address = self.request.address.decode()
# if any(bool(pat.match(address))
# for pat in self.non_checksummed_patterns):
# return True
# addr = address.lstrip('0x')
# addr_hash = sha3.keccak_256(addr.lower().encode('ascii')).hexdigest()
# for i in range(0, len(addr)):
# if any([
# int(addr_hash[i], 16) > 7 and addr[i].upper() != addr[i],
# int(addr_hash[i], 16) <= 7 and addr[i].lower() != addr[i]
# ]):
# return False
# return True

@property
def network(self):
"""Return network derived from network version bytes."""
Expand Down
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

15 changes: 8 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@
license='MIT',
install_requires=[
'attrs>=17.4.0',
'pysha3>=1.0.2',
'base58check>=1.0.1',
'bech32',
'blake256',
'cbor',
'crc16',
'groestlcoin_hash2',
'pycryptodome',
'zope',
'zope.interface>=4.4.3',
'crc16>=0.1.1',
'blake256>=0.1.1',
'cbor>=1.0.0',
'bech32>=1.1.0',
'groestlcoin-hash2>=1.1.1'
],
zip_safe=False,
packages=find_packages(),
Expand All @@ -62,7 +63,7 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: >=3.6',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development',
Expand Down