diff --git a/code/key-to-address-ecc-example.py b/code/key-to-address-ecc-example.py index 2a206535..72f958a1 100644 --- a/code/key-to-address-ecc-example.py +++ b/code/key-to-address-ecc-example.py @@ -35,7 +35,7 @@ print("Public Key (hex) is:", hex_encoded_public_key) # Compress public key, adjust prefix depending on whether y is even or odd (public_key_x, public_key_y) = public_key compressed_prefix = '02' if (public_key_y % 2) == 0 else '03' -hex_compressed_public_key = compressed_prefix + bitcoin.encode(public_key_x, 16) +hex_compressed_public_key = compressed_prefix + (bitcoin.encode(public_key_x, 16).zfill(64)) print("Compressed Public Key (hex) is:", hex_compressed_public_key) # Generate bitcoin address from public key