Bitmessage / PyBitmessage

Reference client for Bitmessage: a P2P encrypted decentralised communication protocol:
https://bitmessage.org/wiki/Main_Page
Other
2.83k stars 576 forks source link

Possible fix for test_random_keys() failure on short keys #2173

Closed PeterSurda closed 9 months ago

PeterSurda commented 9 months ago

Hi!

This is a possible fix for failures like this.

======================================================================
FAIL: test_random_keys (pybitmessage.pyelliptic.tests.test_ecc.TestECC)
A dummy test for random keys in ECC object
----------------------------------------------------------------------
Traceback (most recent call last):
 File "pybitmessage/pyelliptic/tests/test_ecc.py", line 31, in test_random_keys
 self.assertEqual(pubkey[:4], b'\x02\xca\x00\x20')
AssertionError: '\x02\xca\x00\x1f' != '\x02\xca\x00 '

I may be wrong. I preferred to pad the pubkey coordinates in ECC.get_pubkey() because I see the b'\x02\xca\x00 ' literal here in highlevelcrypto. Maybe I should've changed the pubkey parts of test_random_keys() instead, like I did for the privkey?