Пример #1
0
class BitcoinCompressedPublicKeyTest(unittest.TestCase):
    def setUp(self):
        self.reference = {
            'hex_public_key': '02068fd9d47283fb310e6dfb66b141dd78fbabc76d073d48cddc770ffb2bd262d7',
            'bin_public_key': '\x02\x06\x8f\xd9\xd4r\x83\xfb1\x0em\xfbf\xb1A\xddx\xfb\xab\xc7m\x07=H\xcd\xdcw\x0f\xfb+\xd2b\xd7',
            'hex_hash160': '25488b0d3bb770d6e0ef07e1f19d33ab59931dee',
            'bin_hash160': '%H\x8b\r;\xb7p\xd6\xe0\xef\x07\xe1\xf1\x9d3\xabY\x93\x1d\xee',
            'address': '14Q8uVAX29RUMvqPGXL5sg6NiwwMRFCm8C',
        }
        self.public_key = ECPublicKey(self.reference['hex_public_key'])

    def tearDown(self):
        pass

    def test_address(self):
        self.assertEqual(self.public_key.address(), self.reference['address'])

    def test_bin_hash160(self):
        self.assertEqual(
            self.public_key.bin_hash160(), self.reference['bin_hash160'])

    def test_hex_hash160(self):
        self.assertEqual(
            self.public_key.hash160(), self.reference['hex_hash160'])

    def test_bin_public_key(self):
        self.assertEqual(
            self.public_key.to_bin(), self.reference['bin_public_key'])

    def test_hex_public_key(self):
        self.assertEqual(
            self.public_key.to_hex(), self.reference['hex_public_key'])
Пример #2
0
class BitcoinCompressedPublicKeyTest(unittest.TestCase):
    def setUp(self):
        self.reference = {
            'hex_public_key':
            '02068fd9d47283fb310e6dfb66b141dd78fbabc76d073d48cddc770ffb2bd262d7',
            'bin_public_key':
            '\x02\x06\x8f\xd9\xd4r\x83\xfb1\x0em\xfbf\xb1A\xddx\xfb\xab\xc7m\x07=H\xcd\xdcw\x0f\xfb+\xd2b\xd7',
            'hex_hash160': '25488b0d3bb770d6e0ef07e1f19d33ab59931dee',
            'bin_hash160':
            '%H\x8b\r;\xb7p\xd6\xe0\xef\x07\xe1\xf1\x9d3\xabY\x93\x1d\xee',
            'address': '14Q8uVAX29RUMvqPGXL5sg6NiwwMRFCm8C',
        }
        self.public_key = ECPublicKey(self.reference['hex_public_key'])

    def tearDown(self):
        pass

    def test_address(self):
        self.assertEqual(self.public_key.address(), self.reference['address'])

    def test_bin_hash160(self):
        self.assertEqual(self.public_key.bin_hash160(),
                         self.reference['bin_hash160'])

    def test_hex_hash160(self):
        self.assertEqual(self.public_key.hash160(),
                         self.reference['hex_hash160'])

    def test_bin_public_key(self):
        self.assertEqual(self.public_key.to_bin(),
                         self.reference['bin_public_key'])

    def test_hex_public_key(self):
        self.assertEqual(self.public_key.to_hex(),
                         self.reference['hex_public_key'])
Пример #3
0
class BitcoinUncompressedPublicKeyTest(unittest.TestCase):
    reference = _reference_info

    def setUp(self):
        self.public_key = ECPublicKey(self.reference['hex_public_key'])

    def tearDown(self):
        pass

    def test_address(self):
        self.assertEqual(self.public_key.address(), self.reference['address'])

    def test_hex_hash160(self):
        self.assertEqual(
            self.public_key.hash160(), self.reference['hex_hash160'])

    def test_hex_public_key(self):
        self.assertEqual(
            self.public_key.to_hex(), self.reference['hex_public_key'])

    def test_pem_public_key(self):
        self.assertEqual(
            self.public_key.to_pem(), self.reference['pem_public_key'])

    def test_der_public_key(self):
        self.assertEqual(
            self.public_key.to_der(), self.reference['der_public_key'])
Пример #4
0
class BitcoinUncompressedPublicKeyTest(unittest.TestCase):
    reference = _reference_info

    def setUp(self):
        self.public_key = ECPublicKey(self.reference['hex_public_key'])

    def tearDown(self):
        pass

    def test_address(self):
        self.assertEqual(self.public_key.address(), self.reference['address'])

    def test_hex_hash160(self):
        self.assertEqual(self.public_key.hash160(),
                         self.reference['hex_hash160'])

    def test_hex_public_key(self):
        self.assertEqual(self.public_key.to_hex(),
                         self.reference['hex_public_key'])

    def test_pem_public_key(self):
        self.assertEqual(self.public_key.to_pem(),
                         self.reference['pem_public_key'])

    def test_der_public_key(self):
        self.assertEqual(self.public_key.to_der(),
                         self.reference['der_public_key'])
Пример #5
0
class BitcoinCompressedPublicKeyTest(unittest.TestCase):
    def setUp(self):
        self.ref = _compressed_info_2
        self.public_key = ECPublicKey(self.ref['hex_public_key'])

    def tearDown(self):
        pass

    def test_address(self):
        self.assertEqual(self.public_key.address(), self.ref['address'])

    def test_bin_hash160(self):
        self.assertEqual(self.public_key.bin_hash160(), self.ref['bin_hash160'])

    def test_hex_hash160(self):
        self.assertEqual(self.public_key.hash160(), self.ref['hex_hash160'])

    def test_bin_public_key(self):
        self.assertEqual(self.public_key.to_bin(), self.ref['bin_public_key'])

    def test_hex_public_key(self):
        self.assertEqual(self.public_key.to_hex(), self.ref['hex_public_key'])