def makePrivCryptor(privkey_hex):
    privkey_bin = '\x02\xca\x00 ' + arithmetic.changebase(privkey_hex,
                                                          16, 256, minlen=32)
    pubkey_hex = arithmetic.privkey_to_pubkey(privkey_hex)
    pubkey_bin_bare = arithmetic.changebase(pubkey_hex, 16, 256, minlen=65)[1:]
    pubkey_bin = '\x02\xca\x00 ' + pubkey_bin_bare[:32] + '\x00 ' + pubkey_bin_bare[32:]
    cryptor = ec.ECC(curve='secp256k1', privkey=privkey_bin, pubkey=pubkey_bin)
    return cryptor
def makePrivCryptor(privkey_hex):
    privkey_bin = '\x02\xca\x00 ' + arithmetic.changebase(
        privkey_hex, 16, 256, minlen=32)
    pubkey_hex = arithmetic.privkey_to_pubkey(privkey_hex)
    pubkey_bin_bare = arithmetic.changebase(pubkey_hex, 16, 256, minlen=65)[1:]
    pubkey_bin = '\x02\xca\x00 ' + pubkey_bin_bare[:
                                                   32] + '\x00 ' + pubkey_bin_bare[
                                                       32:]
    cryptor = ec.ECC(curve='secp256k1', privkey=privkey_bin, pubkey=pubkey_bin)
    return cryptor
def hexToPubkey(pubkey):
    pubkey_raw = arithmetic.changebase(pubkey[2:], 16, 256, minlen=64)
    pubkey_bin = '\x02\xca\x00 ' + pubkey_raw[:32] + '\x00 ' + pubkey_raw[32:]
    return pubkey_bin
    def test_changebase(self):
        pubkey_hex = arithmetic.privtopub(self.privkey_hex)
        pubkey_bin1 = main.changebase(pubkey_hex, 16, 256)
        pubkey_bin2 = arithmetic.changebase(pubkey_hex, 16, 256)

        self.assertEqual(pubkey_bin1, pubkey_bin2)
    def test_changebase(self):
        pubkey_hex = arithmetic.privtopub(self.privkey_hex)
        pubkey_bin1 = main.changebase(pubkey_hex, 16, 256)
        pubkey_bin2 = arithmetic.changebase(pubkey_hex, 16, 256)

        self.assertEqual(pubkey_bin1, pubkey_bin2)
def hexToPubkey(pubkey):
    pubkey_raw = arithmetic.changebase(pubkey[2:], 16, 256, minlen=64)
    pubkey_bin = '\x02\xca\x00 ' + pubkey_raw[:32] + '\x00 ' + pubkey_raw[32:]
    return pubkey_bin