mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-19 09:25:28 +00:00
update vanity script, check for valid chars
This commit is contained in:
parent
9c88a815eb
commit
b1cbd696b9
@ -58,17 +58,21 @@ class AddrGen:
|
|||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
|
||||||
def runit(self):
|
def runit(self):
|
||||||
|
for ch in self.prefix:
|
||||||
|
if ch not in _zalpha:
|
||||||
|
print("invalid prefix, {} not a valid character".format(ch))
|
||||||
|
return None, None
|
||||||
|
print("find ^{}.loki".format(self.prefix))
|
||||||
i = self._inc
|
i = self._inc
|
||||||
hi = abs(libnacl.randombytes_random())
|
|
||||||
lo = abs(libnacl.randombytes_random())
|
|
||||||
while i > 0:
|
while i > 0:
|
||||||
p = Process(target=self._gen_addr_tick, args=(lo+i, hi+i, _gen_si(self._keys)))
|
p = Process(target=self._gen_addr_tick, args=(self.prefix, abs(libnacl.randombytes_random()), abs(libnacl.randombytes_random()), _gen_si(self._keys)))
|
||||||
p.start()
|
p.start()
|
||||||
self._procs.append(p)
|
self._procs.append(p)
|
||||||
i -=1
|
i -=1
|
||||||
return self._runner()
|
return self._runner()
|
||||||
|
|
||||||
def _gen_addr_tick(self, lo, hi, si):
|
def _gen_addr_tick(self, prefix, lo, hi, si):
|
||||||
|
print(prefix)
|
||||||
fd = BytesIO()
|
fd = BytesIO()
|
||||||
addr = ''
|
addr = ''
|
||||||
enc = bencode.BCodec(fd)
|
enc = bencode.BCodec(fd)
|
||||||
@ -78,7 +82,8 @@ class AddrGen:
|
|||||||
enc.encode(si)
|
enc.encode(si)
|
||||||
pub = bytes(fd.getbuffer())
|
pub = bytes(fd.getbuffer())
|
||||||
addr = zb32_encode(libnacl.crypto_generichash(pub))
|
addr = zb32_encode(libnacl.crypto_generichash(pub))
|
||||||
if addr.startswith(self.prefix):
|
if addr.startswith(prefix):
|
||||||
|
print(addr)
|
||||||
self.sync[2] = 1
|
self.sync[2] = 1
|
||||||
self.sync[0] = hi
|
self.sync[0] = hi
|
||||||
self.sync[1] = lo
|
self.sync[1] = lo
|
||||||
@ -122,10 +127,11 @@ def main(args):
|
|||||||
keys = dec.decode()
|
keys = dec.decode()
|
||||||
runner = AddrGen(int(args[2]), keys, args[1])
|
runner = AddrGen(int(args[2]), keys, args[1])
|
||||||
keys[b'x'], addr = runner.runit()
|
keys[b'x'], addr = runner.runit()
|
||||||
print("found {}.loki".format(addr))
|
if addr:
|
||||||
with open(args[0], 'wb') as fd:
|
print("found {}.loki".format(addr))
|
||||||
enc = bencode.BCodec(fd)
|
with open(args[0], 'wb') as fd:
|
||||||
enc.encode(keys)
|
enc = bencode.BCodec(fd)
|
||||||
|
enc.encode(keys)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv[1:])
|
main(sys.argv[1:])
|
Loading…
Reference in New Issue
Block a user