# Path: caesure/bitcoin.py
# def dhash (s):
#     return sha256(sha256(s).digest()).digest()


import caesure.secp256k1
from .secp256k1 import verify, start, Error as secp256k1_Error
from .bitcoin import dhash
# -*- Mode: Python -*-


caesure.secp256k1.start (verify=True, sign=False)

class KEY:

    def __init__ (self):
        self.p = None

    def set_pubkey (self, key):
        self.p = key

    def verify (self, data, sig, already):
        if not already:
            data = dhash (data)
        try:
            caesure.secp256k1.verify (self.p, data, sig)
            return 1
        except secp256k1_Error:

# Path: caesure/bitcoin.py
# def dhash (s):
#     return sha256(sha256(s).digest()).digest()


# Path: caesure/ecdsa_secp256k1.py
import caesure.secp256k1
from .secp256k1 import verify, start, Error as secp256k1_Error
from .bitcoin import dhash

# -*- Mode: Python -*-


caesure.secp256k1.start (verify=True, sign=False)

class KEY:

    def __init__ (self):
        self.p = None

    def set_pubkey (self, key):
        self.p = key

    def verify (self, data, sig, already):
        if not already:
            data = dhash (data)
        try:
            caesure.secp256k1.verify (self.p, data, sig)
            return 1
        except secp256k1_Error:

            return 0