def test_parse_compressed(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(5001) sec = priv.point.sec(compressed=True) result = S256Point.parse(sec) self.assertEqual(result, priv.point)
def test_sec_compressed(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(5001) result = priv.point.sec(compressed=True).hex() self.assertEqual( result, "0357a4f368868a8a6d572991e484e664810ff14c05c0fa023275251151fe0e53d1" )
def test_sec_uncompressed(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(5000) result = priv.point.sec(compressed=False).hex() self.assertEqual( result, "04ffe558e388852f0120e46af2d1b370f85854a8eb0841811ece0e3e03d282d57c315dc72890a4f10a1481c031b03b351b0dc79901ca18a00cf009dbdb157a1d10", )
def test_wif_compressed_mainnet(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(0x54321DEADBEEF) result = priv.wif() self.assertEqual(result, "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgiuQJv1h8Ytr2S53a")
def test_wif_uncompressed_testnet(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(2021 ** 5) result = priv.wif(compressed=False, testnet=True) self.assertEqual(result, "91avARGdfge8E4tZfYLoxeJ5sGBdNJQH4kvjpWAxgzczjbCwxic")
def test_wif_compressed_testnet(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(5003) result = priv.wif(compressed=True, testnet=True) self.assertEqual(result, "cMahea7zqjxrtgAbB7LSGbcQUr1uX1ojuat9jZodMN8rFTv2sfUK")
def test_sign(self): pk = PrivateKey(randint(0, N)) z = randint(0, 2 ** 256) sig = pk.sign(z) self.assertTrue(pk.point.verify(z, sig))
def test_address_compressed_mainnet(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(0x12345DEADBEEF) result = priv.point.address() self.assertEqual(result, "1F1Pn2y6pDb68E5nYJJeba4TLg2U7B6KF1")
def test_address_compressed_testnet(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(2020**5) result = priv.point.address(compressed=True, testnet=True) self.assertEqual(result, "mopVkxp8UhXqRYbCYJsbeE1h1fiF64jcoH")
def test_address_uncompressed_testnet(self): from ecc.PrivateKey import PrivateKey priv = PrivateKey(5002) result = priv.point.address(compressed=False, testnet=True) self.assertEqual(result, "mmTPbXQFxboEtNRkwfh6K51jvdtHLxGeMA")