コード例 #1
0
 def __init__(self, passphrase="", type=0):
     self.passphrase = passphrase
     self.address = None
     self.public_key = None
     self.private_key = None
     try:
         if type == '1':
             keypair = BitcoinKeypair.from_private_key(
                 self.passphrase.encode('ascii'))
         elif type == '2':
             keypair = BitcoinKeypair.from_private_key(
                 deterministic.electrum_stretch(
                     self.passphrase.encode('utf-8')))
         else:
             keypair = BitcoinKeypair.from_passphrase(
                 self.passphrase.encode('utf-8'))
         self.address = keypair.address()
         self.public_key = keypair.public_key()
         self.private_key = keypair.private_key()
         self.wif = keypair.wif_pk()
     except Exception as e:
         logging.warning(
             u"Failed to generate keypair for passphrase '{}'. Error: {}".
             format(passphrase, e.args))
         raise
コード例 #2
0
 def __init__(self, passphrase):
     self.passphrase = passphrase
     self.address = None
     self.public_key = None
     self.private_key = None
     try:
         keypair = BitcoinKeypair.from_passphrase(self.passphrase)
         self.address = keypair.address()
         self.public_key = keypair.public_key()
         self.private_key = keypair.private_key()
     except Exception as e:
         logging.warning("Failed to generate keypair for passphrase '{}'. Error: {}".format(passphrase, e.args))
コード例 #3
0
 def __init__(self, passphrase, private_key=False):
     self.passphrase = passphrase
     if private_key:
         self.keypair = BitcoinKeypair.from_private_key(
             self.passphrase.encode('ascii'))
     else:
         try:
             self.keypair = BitcoinKeypair.from_passphrase(self.passphrase)
         except Exception:
             LOG.exception(u'Failed to generate keypair from {0}'.format(
                 self.passphrase))
             raise
コード例 #4
0
 def __init__(self, passphrase):
     self.passphrase = passphrase
     self.address = None
     self.public_key = None
     self.private_key = None
     try:
         keypair = BitcoinKeypair.from_passphrase(self.passphrase)
         self.address = keypair.address()
         self.public_key = keypair.public_key()
         self.private_key = keypair.private_key()
     except Exception as e:
         logging.warning(
             u"Failed to generate keypair for passphrase '{}'. Error: {}".
             format(passphrase, e.args))
         raise
コード例 #5
0
 def __init__(self, passphrase = "", type = 0):
     self.passphrase = passphrase
     self.address = None
     self.public_key = None
     self.private_key = None
     try:
         if type == '1':
             keypair = BitcoinKeypair.from_private_key(self.passphrase.encode('ascii'))
         elif type == '2':
             keypair = BitcoinKeypair.from_private_key(deterministic.electrum_stretch(self.passphrase.encode('utf-8')))
         else:
             keypair = BitcoinKeypair.from_passphrase(self.passphrase.encode('utf-8'))
         self.address = keypair.address()
         self.public_key = keypair.public_key()
         self.private_key = keypair.private_key()
         self.wif = keypair.wif_pk()
     except Exception as e:
         logging.warning(u"Failed to generate keypair for passphrase '{}'. Error: {}".format(passphrase, e.args))
         raise
コード例 #6
0
ファイル: vanityBrain.py プロジェクト: ohadcn/vanityBrain
def findVanityInDic(fileName, prefix, maxTries = 0, length = 3, ignoreCase = False):
	if maxTries == 0:
		maxTries = 60**len(prefix)
	dictionary_encoding = "utf-8"
	info("Opening dictionary file {} and validating encoding is {}".format(fileName, dictionary_encoding))
	try:
		f_dictionary = io.open(fileName, 'rt', encoding=dictionary_encoding)
		words = f_dictionary.readlines()
		f_dictionary.close()
	except Exception as e:
		error("Failed to open dictionary file {}. Make sure file is {} encoded.".format(
						fileName, dictionary_encoding))
		exit(1)
	info("finished reading file {}, starting bruteforce...".format(fileName))
	for i in range(maxTries):
		guess = ''.join(sample(words, length)).replace('\n', ' ')
		if isVanity(guess, prefix, ignoreCase):
			return guess, BitcoinKeypair.from_passphrase(guess).address()
	return None
コード例 #7
0
def findVanityInDic(fileName, prefix, maxTries=0, length=3, ignoreCase=False):
    if maxTries == 0:
        maxTries = 60**len(prefix)
    dictionary_encoding = "utf-8"
    info("Opening dictionary file {} and validating encoding is {}".format(
        fileName, dictionary_encoding))
    try:
        f_dictionary = io.open(fileName, 'rt', encoding=dictionary_encoding)
        words = f_dictionary.readlines()
        f_dictionary.close()
    except Exception as e:
        error(
            "Failed to open dictionary file {}. Make sure file is {} encoded.".
            format(fileName, dictionary_encoding))
        exit(1)
    info("finished reading file {}, starting bruteforce...".format(fileName))
    for i in range(maxTries):
        guess = ''.join(sample(words, length)).replace('\n', ' ')
        if isVanity(guess, prefix, ignoreCase):
            return guess, BitcoinKeypair.from_passphrase(guess).address()
    return None
コード例 #8
0
def isVanity(seed, prefix, ignoreCase=False):
    key = BitcoinKeypair.from_passphrase(seed)
    if ignoreCase:
        return key.address().lower().startswith(prefix)
    else:
        return key.address().startswith(prefix)
コード例 #9
0
ファイル: vanityBrain.py プロジェクト: ohadcn/vanityBrain
def isVanity(seed, prefix, ignoreCase = False):
	key = BitcoinKeypair.from_passphrase(seed)
	if ignoreCase:
		return key.address().lower().startswith(prefix)
	else:
		return key.address().startswith(prefix)