def test_bulk_keymatch(self): """ Tests key recovery over several keys """ msg = 'foo' for _ in range(0, 20): priv = pbt.random_key() sig = pbt.ecdsa_sign(msg, priv) native_recovered = pbct_nativerecover.recover_pubkey(msg, sig) py_recovered = pbt.ecdsa_recover(msg, sig) self.assertEquals(native_recovered, py_recovered, "Priv Key that failed: {}".format(priv))
def test_bulk_keymatch(self): """ Tests key recovery over several keys """ msg = 'foo' self.longMessage = True for x in range(0, 20): priv = pbt.random_key() sig = pbt.ecdsa_sign(msg, priv) native_recovered = gossip.signed_object.get_verifying_key(msg, sig) py_recovered = pbt.ecdsa_recover(msg, sig) self.assertEquals(native_recovered, py_recovered, "Priv Key that failed: {}".format(priv))
def test_pbt_match(self): """ Tests matching results between pybitcointools and native ECDSA key recovery """ # This key has a small public key value which tests padding wifstr = '5JtMb6tmM9vT6QHyM7RR8pjMViqccukgMFNCPvG5xhLVf6CMoGx' priv = pbt.decode_privkey(wifstr, 'wif') msg = 'foo' sig = pbt.ecdsa_sign(msg, priv) native_recovered = gossip.signed_object.get_verifying_key(msg, sig) py_recovered = pbt.ecdsa_recover(msg, sig) self.assertEquals(native_recovered, py_recovered)
def test_bulk_keymatch(self): """ Tests key recovery over several keys """ msg = 'foo' self.longMessage = True for x in range(0, 20): priv = pbt.random_key() sig = pbt.ecdsa_sign(msg, priv) native_recovered = gossip.signed_object.get_verifying_key(msg, sig) py_recovered = pbt.ecdsa_recover(msg, sig) self.assertEquals(native_recovered, py_recovered, "Priv Key that failed: {}".format(priv))
def test_pbt_match(self): """ Tests matching results between pybitcointools and native ECDSA key recovery """ # This key has a small public key value which tests padding wifstr = '5JtMb6tmM9vT6QHyM7RR8pjMViqccukgMFNCPvG5xhLVf6CMoGx' priv = pbt.decode_privkey(wifstr, 'wif') msg = 'foo' sig = pbt.ecdsa_sign(msg, priv) native_recovered = gossip.signed_object.get_verifying_key(msg, sig) py_recovered = pbt.ecdsa_recover(msg, sig) self.assertEquals(native_recovered, py_recovered)