user25105: When creating a private key, how would I ensure that there is a mini private key equivalent, which could be substituted in place of the the full private key? What math would I have to use to create such a private key for bitcoins?

user2306: You can't create a minikey for a private key - you need to create a private key once you've created a minikey.
You need to ensure that the SHA256 of the mini key plus a question mark after it has a hash starting with 00.
Or, in Python:
sha256(candidate + "?")[0] == chr(0)

The following Python program will generate mini keys:
import hashlib
from binascii import hexlify as hx
import random
rand = random.SystemRandom()

B58_ALPHA = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

def sha256(s):
    return hashlib.sha256(s).digest()

def gen_candidate():
    candidate = "S"
    for i in xrange(29):
        candidate = candidate + rand.choice(B58_ALPHA)
    return candidate

def test_candidate(candidate):
    return sha256(candidate + "?")[0] == chr(0)

while True:
    c = gen_candidate()
    if test_candidate(c):
        print c, hx(sha256(c))


25105: <p>When creating a private key, how would I ensure that there is a <a href="https://en.bitcoin.it/wiki/Mini_private_key_format" rel="nofollow">mini private key equivalent</a>, which could be substituted in place of the the full private key? What math would I have to use to create such a private key for bitcoins?</p>
 2306: <p>You can't create a minikey for a private key - you need to create a private key once you've created a minikey.</p>

<p>You need to ensure that the SHA256 of the mini key plus a question mark after it has a hash starting with <code>00</code>.</p>

<p>Or, in Python:</p>

<pre><code>sha256(candidate + "?")[0] == chr(0)
</code></pre>

<p>The following Python program will generate mini keys:</p>

<pre><code>import hashlib
from binascii import hexlify as hx
import random
rand = random.SystemRandom()

B58_ALPHA = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

def sha256(s):
    return hashlib.sha256(s).digest()

def gen_candidate():
    candidate = "S"
    for i in xrange(29):
        candidate = candidate + rand.choice(B58_ALPHA)
    return candidate

def test_candidate(candidate):
    return sha256(candidate + "?")[0] == chr(0)

while True:
    c = gen_candidate()
    if test_candidate(c):
        print c, hx(sha256(c))
</code></pre>
