Пример #1
0
def add_vanity():
    key_manager = keymanager.KeyManager()
    tell = lambda tell: logger.info(tell, terminal=True)
    words = ''
    length = len(sys.argv) - 2
    if length == 0: return
    for i in range(2, len(sys.argv)):
        words += ' '
        words += sys.argv[i]
    try:
        if length == 1:
            tell('Finding vanity, this should only take a few moments.')
        else:
            tell('Finding vanity, this will probably take a really long time.')
        try:
            vanity = vanityonionr.find_multiprocess(words)
        except ValueError:
            logger.warn('Vanity words must be valid english bip39',
                        terminal=True)
        else:
            b32_pub = unpaddedbase32.b32encode(vanity[0])
            tell('Found vanity address:\n' +
                 niceware.bytes_to_passphrase(vanity[0]))
            tell('Base32 Public key: %s' % (b32_pub.decode(), ))
            key_manager.addKey(b32_pub, unpaddedbase32.b32encode(vanity[1]))
    except KeyboardInterrupt:
        pass
Пример #2
0
 def test_basic(self):
     pair = vanityonionr.find_multiprocess("onion")
     b = niceware.bytes_to_passphrase(pair[0])
     self.assertTrue(b[0].startswith("onion"))