How to use the fastecdsa._ecdsa.verify function in fastecdsa

To help you get started, we’ve selected a few fastecdsa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 1200wd / bitcoinlib / bitcoinlib / keys.py View on Github external
:type tx_hash: bytes, hexstring
        :param public_key: Public key P
        :type public_key: HDKey, Key, str, hexstring, bytes
                
        :return bool: 
        """
        if tx_hash is not None:
            self.tx_hash = to_hexstring(tx_hash)
        if public_key is not None:
            self.public_key = public_key

        if not self.tx_hash or not self.public_key:
            raise BKeyError("Please provide tx_hash and public_key to verify signature")

        if USE_FASTECDSA:
            return _ecdsa.verify(
                str(self.r),
                str(self.s),
                self.tx_hash,
                str(self.x),
                str(self.y),
                str(secp256k1_p),
                str(secp256k1_a),
                str(secp256k1_b),
                str(secp256k1_n),
                str(secp256k1_Gx),
                str(secp256k1_Gy)
            )
        else:
            transaction_to_sign = to_bytes(self.tx_hash)
            signature = self.bytes()
            if len(transaction_to_sign) != 32: