from hashlib import sha256  # Python standard lib SHA2 is already in C
from os import urandom

from fastecdsa import _ecdsa


class KeyPair:
    def __init__(self, curve):
        d = int(urandom(32).encode('hex'), 16)
        while d >= curve.q:
            d = int(urandom(32).encode('hex'), 16)

        self.d = d
        self.Q = curve.pointMul(curve.G, d)
        self.curve = curve

    def sign(self, msg):
        hashed = sha256(msg).hexdigest()[-64:]
        r, s = _ecdsa.sign(hashed, str(self.d), 'P256')
        return int(r), int(s)

    def verify(self, sig, msg):
        r, s = sig
        qx, qy = self.Q
        hashed = sha256(msg).hexdigest()
        return _ecdsa.verify(str(r), str(s), hashed, str(qx), str(qy), 'P256')

@@ -452,14 +452,8 @@
 st()
-%5B-64:%5D
 %0A   
@@ -497,22 +497,31 @@
 elf.d), 
-'P256'
+self.curve.name
 )%0A      
@@ -736,12 +736,21 @@
 y), 
-'P256'
+self.curve.name
 )%0A

remove hardcoded curve from ECDSA