I'm doing a small research project collecting information on minikeys. In that research process I've come across a couple of questions that I have been unable to answer in relation to the assumed keyspace of the version one minikey. The said mini key, was used primarily by Casascius Series 1 coins, and consisted of the following parameters

  • Generated using Base58 encoding scheme
  • Consists of a total of 22 Characters, of which 21 are random, with the 1st character being a capital S prefix

Has the following requirements to be considered well formatted:

  • If the minikey appended by a ? at the end of the string hashed using SHA256 results in the first byte being 00, the string is a well formatted minikey

Key Question: Is there any way to calculate the potential number of keys within the massive 58^21 keyspace that would be considered properly formatted?

My current suspicion is that it's not possible to do so because the validation involves hashing and the entire input of the entire minikey input would be needed to generate a proper hash (meaning potentially in order to calculate the possible number of valid keys, every potential key, of a impossibly large keyspace would need to be generated, which is currently impossible). However I am asking this question with the hope that this suspicion is incorrect and that it is somehow possible to calculate the possible number of valid well formatted keys.

For reading on this subject I would recommend checking out:


Be warned, the python script needs minor modifications to run on Python2.7

Bold is for key questions Italics if for important thoughts

Note: This post intentionally does not cover the more secure Casascius Series 2 Keys, however it is likely assuming that there exists an answer for Series 1 keys that the process can be used on Series 2 as well.

1 Answer 1


Because outputs of SHA-256 can be considered equally distributed for the whole space and this property passes for the first one byte of those outputs, you can calculate this number easily with a really good approximation. One in every 256 in the space you mentioned would be a valid minikey. This approximation would be very good, since the space is, as you noted, really large, so it follows the law of large numbers.

If you needed an exact number, however, your assumption would be correct, though, calculating this number would require to check every possible "candidate" minikey in the space, which would essentially be bruteforcing the whole space and won't be computationally feasible.

  • 1
    Fantastic, this appears to be the answer I was looking for Jun 1, 2020 at 4:26
  • I'm happy to help, @RasikhMorani. Would you mind marking the answer as accepted and upvoting it? Jun 1, 2020 at 8:02
  • 1
    Accepted! Upvoted, but I don't have enough reputation for my upvote to show Jun 6, 2020 at 4:07
  • Ah, I see. Thank you kindly for the accept Jun 19, 2020 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.