Closed rymkapro closed 4 years ago
k
should become different after running that code. What it does it increase k
by a multiple of order to make sure its length is always the same. This shouldn't affect the result. For me, running the following code:
import sslcrypto
curve = sslcrypto.fallback.ecc.get_curve('secp256k1')
private_key = "8ad6b82c970c27657c79d79b55d4840c16ac9dbf02eff32e6daf80e4dda1925c"
message = "a75a6dfdd271971f8c2994e3ee8a4f2c9b6949aa27d4aa32fd87617b22b4e67b"
signature = curve.sign(
data=bytes.fromhex(message), private_key=bytes.fromhex(private_key),
recoverable=True, hash=None
)
pub_key_length = 32
v = signature[0]
r = int.from_bytes(signature[1:pub_key_length+1], byteorder='big')
s = int.from_bytes(signature[pub_key_length+1:], byteorder='big')
print(v)
print(r)
print(s)
...produces the same results regardless of the fix.
I'm so sorry.. I don't know what is was. Now everything is great. Thanks a lot!
Hi, I've started to use your great package, but encountered some bugs or not (don't know).
File: fallback/ecc.py I have
bitcoin
package installed and I compared results with this package (I know that it works correctly).So, I have a message to sign "a75a6dfdd271971f8c2994e3ee8a4f2c9b6949aa27d4aa32fd87617b22b4e67b" I don't need hashing, so I make following:
Values I get, are incorrect, but
But after code below
k
becomes incorrect. If I comment code below, v, r, s and everything is perfect.Thanks for your help!