moved to niceware from mnemonic
This commit is contained in:
parent
86ae8327c3
commit
48e956c27c
7 changed files with 14 additions and 18 deletions
|
@ -19,7 +19,7 @@
|
|||
'''
|
||||
import base64
|
||||
|
||||
import mnemonic
|
||||
import niceware
|
||||
import unpaddedbase32
|
||||
|
||||
import onionrcrypto
|
||||
|
@ -27,8 +27,6 @@ from etc import onionrvalues
|
|||
|
||||
DELIMITER = '-'
|
||||
|
||||
m = mnemonic.Mnemonic('english')
|
||||
|
||||
def get_human_readable_ID(pub=''):
|
||||
'''gets a human readable ID from a public key'''
|
||||
if pub == '':
|
||||
|
@ -37,8 +35,9 @@ def get_human_readable_ID(pub=''):
|
|||
if not len(pub) == onionrvalues.MAIN_PUBLIC_KEY_SIZE:
|
||||
pub = base64.b32decode(pub)
|
||||
|
||||
return m.to_mnemonic(pub).replace(' ', DELIMITER)
|
||||
return DELIMITER.join(niceware.bytes_to_passphrase(pub))
|
||||
#return niceware.bytes_to_passphrase(pub).replace(' ', DELIMITER)
|
||||
|
||||
def get_base32(words):
|
||||
'''converts mnemonic to base32'''
|
||||
return unpaddedbase32.b32encode(m.to_entropy(words.replace(DELIMITER, ' ')))
|
||||
return unpaddedbase32.b32encode(niceware.passphrase_to_bytes(words.replace(DELIMITER, ' ')))
|
||||
|
|
|
@ -21,7 +21,7 @@ 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 niceware
|
||||
import nacl.signing, nacl.encoding
|
||||
|
||||
import multiprocessing
|
||||
|
@ -29,8 +29,7 @@ from multiprocessing import Process, Pipe, Queue
|
|||
import re, time
|
||||
import threading
|
||||
|
||||
m = mnemonic.Mnemonic("english")
|
||||
wordlist = m.wordlist
|
||||
wordlist = niceware.WORD_LIST
|
||||
|
||||
def find_vanity_mnemonic(start_words: str, queue):
|
||||
|
||||
|
@ -41,7 +40,7 @@ def find_vanity_mnemonic(start_words: str, queue):
|
|||
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])
|
||||
vanity_key = niceware.bytes_to_passphrasec(key_pair[0])
|
||||
check += 1
|
||||
else:
|
||||
queue.put(key_pair)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue