moved vanityonionr into onionr repo
parent
4df69b7842
commit
631510f4fe
|
@ -0,0 +1,92 @@
|
||||||
|
"""
|
||||||
|
Onionr Vanity address generator
|
||||||
|
|
||||||
|
Library to generate vanity ed25519 addresses in various encodings
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
Onionr Vanity Address Generator
|
||||||
|
Copyright (C) 2019 Kevin Froman
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import mnemonic
|
||||||
|
import nacl.signing, nacl.encoding
|
||||||
|
|
||||||
|
import multiprocessing
|
||||||
|
from multiprocessing import Process, Pipe, Queue
|
||||||
|
import re, time
|
||||||
|
import threading
|
||||||
|
|
||||||
|
m = mnemonic.Mnemonic("english")
|
||||||
|
wordlist = m.wordlist
|
||||||
|
|
||||||
|
def find_vanity_mnemonic(start_words: str, queue):
|
||||||
|
|
||||||
|
key_pair = [b"", b""]
|
||||||
|
vanity_key = ""
|
||||||
|
check = 0
|
||||||
|
while not vanity_key.startswith(start_words):
|
||||||
|
key = nacl.signing.SigningKey.generate()
|
||||||
|
key_pair[1] = key.encode(nacl.encoding.RawEncoder)
|
||||||
|
key_pair[0] = key.verify_key.encode(encoder=nacl.encoding.RawEncoder)
|
||||||
|
vanity_key = m.to_mnemonic(key_pair[0])
|
||||||
|
check += 1
|
||||||
|
else:
|
||||||
|
queue.put(key_pair)
|
||||||
|
#print("DONE", check, key_pair)
|
||||||
|
return key_pair
|
||||||
|
|
||||||
|
def _start(start_words, obj):
|
||||||
|
done = False
|
||||||
|
q = Queue()
|
||||||
|
p = Process(target=find_vanity_mnemonic, args=[start_words, q])
|
||||||
|
p.daemon = True
|
||||||
|
p.start()
|
||||||
|
rec = None
|
||||||
|
while not done:
|
||||||
|
try:
|
||||||
|
if rec == None:
|
||||||
|
rec = q.get(True, 1)
|
||||||
|
except:
|
||||||
|
rec = None
|
||||||
|
if rec != None or obj.done:
|
||||||
|
done = True
|
||||||
|
obj.done = True
|
||||||
|
obj.result = rec
|
||||||
|
return rec
|
||||||
|
|
||||||
|
def handler(start_words: str):
|
||||||
|
obj = lambda test: None
|
||||||
|
obj.done = False
|
||||||
|
for x in range(multiprocessing.cpu_count()):
|
||||||
|
threading.Thread(target=_start, args=[start_words, obj]).start()
|
||||||
|
while not obj.done:
|
||||||
|
time.sleep(1)
|
||||||
|
return obj.result
|
||||||
|
|
||||||
|
|
||||||
|
def find_multiprocess(start_words: str):
|
||||||
|
start_words = start_words.strip()
|
||||||
|
start_words = re.sub(' +', ' ', start_words)
|
||||||
|
test_words = str(start_words)
|
||||||
|
|
||||||
|
for word in test_words.split(' '):
|
||||||
|
for validword in wordlist:
|
||||||
|
if word == validword:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise ValueError('%s not in english bip39 wordlist' % (word,))
|
||||||
|
return handler(start_words)
|
||||||
|
|
|
@ -11,4 +11,3 @@ streamedrequests==1.0.0
|
||||||
jinja2==2.10.1
|
jinja2==2.10.1
|
||||||
toomanyobjs==1.1.0
|
toomanyobjs==1.1.0
|
||||||
mnemonic==0.18
|
mnemonic==0.18
|
||||||
vanityonionr==0.0.0
|
|
|
@ -185,8 +185,6 @@ unpaddedbase32==0.1.0 \
|
||||||
urllib3==1.24.2 \
|
urllib3==1.24.2 \
|
||||||
--hash=sha256:4c291ca23bbb55c76518905869ef34bdd5f0e46af7afe6861e8375643ffee1a0 \
|
--hash=sha256:4c291ca23bbb55c76518905869ef34bdd5f0e46af7afe6861e8375643ffee1a0 \
|
||||||
--hash=sha256:9a247273df709c4fedb38c711e44292304f73f39ab01beda9f6b9fc375669ac3
|
--hash=sha256:9a247273df709c4fedb38c711e44292304f73f39ab01beda9f6b9fc375669ac3
|
||||||
vanityonionr==0.0.0 \
|
|
||||||
--hash=sha256:a61976c62363f05cc9f92e57c2c2deaad7753abc9e5d3ee9ad5745330b8d942e
|
|
||||||
werkzeug==0.15.5 \
|
werkzeug==0.15.5 \
|
||||||
--hash=sha256:87ae4e5b5366da2347eb3116c0e6c681a0e939a33b2805e2c0cbd282664932c4 \
|
--hash=sha256:87ae4e5b5366da2347eb3116c0e6c681a0e939a33b2805e2c0cbd282664932c4 \
|
||||||
--hash=sha256:a13b74dd3c45f758d4ebdb224be8f1ab8ef58b3c0ffc1783a8c7d9f4f50227e6 \
|
--hash=sha256:a13b74dd3c45f758d4ebdb224be8f1ab8ef58b3c0ffc1783a8c7d9f4f50227e6 \
|
||||||
|
|
Loading…
Reference in New Issue