Summary
This is an extended question to How are ethereum addresses generated?.
In Ethereum, a private key is 256-bit long, but an address is only 160-bit long. By "Pigeonhole Principle", it guarantees that some unique private keys map to the same address. Theoretically, 2 ** 96
unique private keys maps to one address on average.
Question
If 2 private keys map to the same address, do they both gain access to the same address? Can they both used to transfer Ether from that address to another?
Details
According to @tayvano's answer, a private key is 256-bit long, and any 256-bit string is a valid private key:
Every single string of 64 hex are, hypothetically, an Ethereum private key that will access an account.
Therefore, there are 2 ** 256
valid private keys (the key space is 2 ** 256
).
A public key is 512-bit long. However, since each of them is derived from its own private key, there are only 2 ** 256
valid public key, and thus the key space is 2 ** 256
.
The public key is then feed as the input of Keccak-256
(pre-standard SHA3) hash algorithm. The output of Keccak-256
is a 256-bit string, therefore it could be treated as a one-to-one mapping in key space. (The hash space is 2 ** 256
)
However, an Ethereum address is obtained from the least significant 160-bit of the Keccak-256
hash. This cuts the key space to 2 ** 160
.
As a result, the process of generating an address from a private key is a function of a 256-bit value to a 160-bit value, which guarantees duplicates.
2 ** 96
keys work on the same address, or is there any mechanism to distinguish the "real" key from the others.