def setUpClass(cls): cls.privkey_hex = ( 'e9873d79c6d87dc0fb6a5778633389f4453213303da61f20bd67fc233aa33262') cls.privkey_bin = crypto_util.privkey_to_pyelliptic(cls.privkey_hex) cls.pubkey_hex = arithmetic.privkey_to_pubkey(cls.privkey_hex) cls.pubkey_bin = crypto_util.pubkey_to_pyelliptic(cls.pubkey_hex) cls.pubkey_hex_strip = cls.pubkey_hex[2:] cls.plaintext = "YELLOW SUBMARINE"
def test_privkey_to_pyelliptic(self): privkey_bin_fmt = crypto_util.privkey_to_pyelliptic(self.privkey_hex) header_bin = crypto_util.BTC_CURVE_OPENSSL_ID_HEX.decode('hex') length_bin = crypto_util.BTC_EC_POINT_LENGTH_HEX.decode('hex') privkey_bin = arithmetic.changebase( self.privkey_hex, 16, 256, minlen=crypto_util.BTC_EC_POINT_LENGTH) self.assertEqual(privkey_bin_fmt[:2], header_bin) self.assertEqual(privkey_bin_fmt[2:4], length_bin) self.assertEqual(privkey_bin_fmt[4:], privkey_bin)
def setUpClass(cls): cls.privkey_hex = ( 'e9873d79c6d87dc0fb6a5778633389f4453213303da61f20bd67fc233aa33262' ) cls.privkey_bin = crypto_util.privkey_to_pyelliptic(cls.privkey_hex) cls.pubkey_hex = arithmetic.privkey_to_pubkey(cls.privkey_hex) cls.pubkey_bin = crypto_util.pubkey_to_pyelliptic(cls.pubkey_hex) cls.pubkey_hex_strip = cls.pubkey_hex[2:] cls.plaintext = "YELLOW SUBMARINE"
def test_privkey_to_pyelliptic(self): privkey_bin_fmt = crypto_util.privkey_to_pyelliptic(self.privkey_hex) header_bin = crypto_util.BTC_CURVE_OPENSSL_ID_HEX.decode('hex') length_bin = crypto_util.BTC_EC_POINT_LENGTH_HEX.decode('hex') privkey_bin = arithmetic.changebase( self.privkey_hex, 16, 256, minlen=crypto_util.BTC_EC_POINT_LENGTH ) self.assertEqual(privkey_bin_fmt[:2], header_bin) self.assertEqual(privkey_bin_fmt[2:4], length_bin) self.assertEqual(privkey_bin_fmt[4:], privkey_bin)