def generate_keypair(crypto, seed, password=None):
if crypto in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>raise CurrencyNotSupported("<STR_LIT>")<EOL><DEDENT>pub_byte, priv_byte = get_magic_bytes(crypto)<EOL>priv = sha256(seed)<EOL>pub = privtopub(priv)<EOL>priv_wif = encode_privkey(priv, '<STR_LIT>', vbyte=priv_byte)<EOL>if password:<EOL><INDENT>from .bip38 import Bip38EncryptedPrivateKey<EOL>priv_wif = str(Bip38EncryptedPrivateKey.encrypt(crypto, priv_wif, password))<EOL><DEDENT>compressed_pub = encode_pubkey(pub, '<STR_LIT>')<EOL>ret = {<EOL>'<STR_LIT>': {<EOL>'<STR_LIT>': pub,<EOL>'<STR_LIT>': compressed_pub,<EOL>'<STR_LIT:address>': pubtoaddr(compressed_pub, pub_byte)<EOL>},<EOL>'<STR_LIT>': {<EOL>'<STR_LIT>': priv_wif<EOL>}<EOL>}<EOL>if not password:<EOL><INDENT>ret['<STR_LIT>']['<STR_LIT>'] = encode_privkey(priv, '<STR_LIT>', vbyte=priv_byte)<EOL>ret['<STR_LIT>']['<STR_LIT>'] = encode_privkey(priv, '<STR_LIT>', vbyte=priv_byte)<EOL>ret['<STR_LIT>']['<STR_LIT>'] = encode_privkey(priv, '<STR_LIT>', vbyte=priv_byte)<EOL><DEDENT>return ret<EOL>
Generate a private key and publickey for any currency, given a seed.
That seed can be random, or a brainwallet phrase.