I'm working on a sharing protocol, and the handshake, authentication etc. is done with RSA keys. By default I use 4096 bit keys, but it seems the beginning and end of any key generated are the same, how worried should I be?
This phenomenon happens both on Windows and Linux.
The python code generating the keys is roughly this:
from Crypto.PublicKey import RSA
from Crypto import Random
random_generator = Random.new().read
prv = RSA.generate(4096, random_generator)
Some example keys I generated (snipped), two on Windows, one on Linux:
30820222300d06092a864886f70d01010105000382020f003082020a0282020100b420065527689ff14a115a9c1b63bf79294407bf621d4ab...0da370203010001
30820222300d06092a864886f70d01010105000382020f003082020a0282020100b39291f674eddfe8d8571b856bf7f83c01ca8ba231f16e8...678590203010001
30820222300d06092a864886f70d01010105000382020f003082020a02820201009a2bec7fad52fe7c50cce509b3406b8ff981a626f28082e...0e98d0203010001
As you can see, the some 66 first and 10 last nibbles are identical, over 300 bits.
Should I ditch the rng for some other or am I just too paranoid?
pycryptodome
that are mostly compatible with the PyCrypto API. Not sure if it will help with your specific problem though.