I am generating ECC private keys. however I noticed that since ECC private key is just a BigInteger. e.g. spec256k1
says private key is anywhere between [0~2^256-1].
my question is, if everyone is using Random(32)
to generate a 32bytes private key, there is not likely but still possible situation that 2 people could generate the same private key. therefore also same public key.
so if this happens on blockchain like Bitcoin or Etheruem, does that mean those 2 people are in theory sharing the same account? or wallet address?
maybe I am missing some details here. Please guide me.
Edit:
thanks for everyone's answer here.
the reason why I was asking this is because first I wonder if there is any protection against collision in the system. however, if there is, and you are told you had a collision, that basically means you figured out someone else's private key...
second reason is, I was considering generating a long(64bits) and then cast into BigInteger(32bytes) to be the private key. however, that will have a much higher collision chance due to the fact that I will only have a private key space of 2^64
.