From d9531c33cb93e289dd8d0e47bb843ebae5da85d7 Mon Sep 17 00:00:00 2001 From: lash Date: Sun, 6 Mar 2022 19:31:17 +0000 Subject: [PATCH 1/3] Upgrade confini --- requirements.txt | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index a3088d1..dbb2cd6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,8 +3,8 @@ pysha3==1.0.2 rlp==2.0.1 #rlp==3.0.0 json-rpc==1.13.0 -confini~=0.5.1 +confini~=0.6.0 coincurve==15.0.0 -hexathon~=0.1.0 +hexathon~=0.1.5 pycryptodome==3.10.1 funga==0.5.2 diff --git a/setup.py b/setup.py index f2f917d..22b9682 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ f.close() setup( name="funga-eth", - version="0.5.6", + version="0.6.0", description="Ethereum implementation of the funga keystore and signer", author="Louis Holbrook", author_email="dev@holbrook.no", From a534f8ca1ece205c86491af4dcaae0dc3bfbc871 Mon Sep 17 00:00:00 2001 From: lash Date: Wed, 4 May 2022 18:09:01 +0000 Subject: [PATCH 2/3] Avoid padding of missing nibble in address --- CHANGELOG | 4 ++++ funga/eth/encoding.py | 6 +++--- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 289faa6..ca2ce5e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +* 0.6.1 + - Avoid padding of addresses missing one nibble +* 0.6.0 + - Upgrade confini * 0.5.4 - Add message signer cli - Add pbkdf2 support diff --git a/funga/eth/encoding.py b/funga/eth/encoding.py index db69a21..cd20086 100644 --- a/funga/eth/encoding.py +++ b/funga/eth/encoding.py @@ -41,7 +41,7 @@ def private_key_to_address(pk, result_format='hex'): def is_address(address_hex): try: - address_hex = strip_0x(address_hex) + address_hex = strip_0x(address_hex, pad=False) except ValueError: return False return len(address_hex) == 40 @@ -57,10 +57,10 @@ def is_checksum_address(address_hex): def to_checksum_address(address_hex): - address_hex = strip_0x(address_hex) - address_hex = uniform(address_hex) + address_hex = strip_0x(address_hex, pad=False) if len(address_hex) != 40: raise ValueError('Invalid address length') + address_hex = uniform(address_hex) h = sha3.keccak_256() h.update(address_hex.encode('utf-8')) z = h.digest() diff --git a/requirements.txt b/requirements.txt index dbb2cd6..86cd93e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,6 @@ rlp==2.0.1 json-rpc==1.13.0 confini~=0.6.0 coincurve==15.0.0 -hexathon~=0.1.5 +hexathon~=0.1.6 pycryptodome==3.10.1 funga==0.5.2 diff --git a/setup.py b/setup.py index 22b9682..cb51f30 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ f.close() setup( name="funga-eth", - version="0.6.0", + version="0.6.1", description="Ethereum implementation of the funga keystore and signer", author="Louis Holbrook", author_email="dev@holbrook.no", From 05435268bf16ad8451da510dc22b173bd59bdac6 Mon Sep 17 00:00:00 2001 From: lash Date: Tue, 24 May 2022 13:17:30 +0000 Subject: [PATCH 3/3] Allow binary msg sign in cli tool --- CHANGELOG | 2 ++ funga/eth/runnable/msg.py | 10 +++++++++- setup.py | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ca2ce5e..24523b3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* 0.6.2 + - Enable signing of binary message * 0.6.1 - Avoid padding of addresses missing one nibble * 0.6.0 diff --git a/funga/eth/runnable/msg.py b/funga/eth/runnable/msg.py index 279a9be..9495b6a 100644 --- a/funga/eth/runnable/msg.py +++ b/funga/eth/runnable/msg.py @@ -24,6 +24,7 @@ argparser.add_argument('-f', type=str, help='Keyfile to use for signing') argparser.add_argument('-z', action='store_true', help='zero-length password') argparser.add_argument('-v', action='store_true', help='be verbose') argparser.add_argument('-0', dest='nonl', action='store_true', help='no newline at end of output') +argparser.add_argument('-b', '--binary', dest='binary', action='store_true', help='parse input as binary hex') argparser.add_argument('msg', type=str, help='Message to sign') args = argparser.parse_args() @@ -42,7 +43,14 @@ def main(): address = keystore.import_keystore_file(args.f, password=passphrase) signer = EIP155Signer(keystore) - sig = signer.sign_ethereum_message(address, args.msg.encode('utf-8').hex(), password=passphrase) + + msg = None + if args.binary: + hx = strip_0x(args.msg, pad=True) + msg = bytes.fromhex(hx) + else: + msg = args.msg.encode('utf-8').hex() + sig = signer.sign_ethereum_message(address, msg, password=passphrase) r = sig.hex() if not args.nonl: diff --git a/setup.py b/setup.py index cb51f30..7cabe82 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ f.close() setup( name="funga-eth", - version="0.6.1", + version="0.6.2", description="Ethereum implementation of the funga keystore and signer", author="Louis Holbrook", author_email="dev@holbrook.no",