So this is a pretty huge problem I've run into once before:
I'm using web3j-android and I'm going through the process of generating random private keys and public keys using the ECKeyPair class
Now I know private keys are generally supposed to be random 64 length strings but every once in a while (it's happened twice in around ~200 tests) I'll get this:
Note the sillyness here for 2 reasons:
1 - The key is triple verified as you can see in the logs, to be 63 characters
2 - a a 40 char length public address is still produced, which is weird because if it my private key was 63 characters how can that happen?
I consider this a serious error because if that were to happen silently and I were to trust it as good, there would be no way for me to sign transactions at all, much less import the wallet, the private key would be invalid. And the ether I would send to the public address would be lost forever.
The sinister part is that this all seems to check out as valid, at first glance. The key is only off by 1 char. I only happened to notice it as I was playing with the character counter on android studio's IDE.
I could run a check to make sure that the string produced is 64 char, but my overarching question is why does this happen to begin with?