moved to niceware from mnemonic
parent
86ae8327c3
commit
48e956c27c
2
Makefile
2
Makefile
|
@ -30,7 +30,7 @@ soft-reset:
|
|||
|
||||
reset:
|
||||
@echo "Hard-resetting Onionr..."
|
||||
rm -rf onionr/$(ONIONR_HOME)/ | true > /dev/null 2>&1
|
||||
rm -rf $(ONIONR_HOME)/ | true > /dev/null 2>&1
|
||||
cd onionr/static-data/www/ui/; rm -rf ./dist; python compile.py
|
||||
#@./onionr.sh version | grep -v "Failed" --color=always
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
ORIG_ONIONR_RUN_DIR=`pwd`
|
||||
cd "$(dirname "$0")"
|
||||
cd onionr/
|
||||
cd onionr
|
||||
./__init__.py "$@"
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -10,4 +10,4 @@ unpaddedbase32==0.1.0
|
|||
streamedrequests==1.0.0
|
||||
jinja2==2.10.1
|
||||
toomanyobjs==1.1.0
|
||||
mnemonic==0.18
|
||||
niceware==0.2.1
|
||||
|
|
|
@ -137,11 +137,9 @@ markupsafe==1.1.1 \
|
|||
--hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \
|
||||
--hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \
|
||||
# via jinja2
|
||||
mnemonic==0.18 \
|
||||
--hash=sha256:02a7306a792370f4a0c106c2cf1ce5a0c84b9dbd7e71c6792fdb9ad88a727f1d
|
||||
pbkdf2==1.3 \
|
||||
--hash=sha256:ac6397369f128212c43064a2b4878038dab78dab41875364554aaf2a684e6979 \
|
||||
# via mnemonic
|
||||
niceware==0.2.1 \
|
||||
--hash=sha256:0f8b192f2a1e800e068474f6e208be9c7e2857664b33a96f4045340de4e5c69c \
|
||||
--hash=sha256:cf2dc0e1567d36d067c61b32fed0f1b9c4534ed511f9eeead4ba548d03b5c9eb
|
||||
pycparser==2.19 \
|
||||
--hash=sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3 \
|
||||
# via cffi
|
||||
|
|
|
@ -51,7 +51,7 @@ class OnionrCryptoTests(unittest.TestCase):
|
|||
|
||||
def test_human_readable_length(self):
|
||||
human = mnemonickeys.get_human_readable_ID()
|
||||
self.assertTrue(len(human.split('-')) == 24)
|
||||
self.assertTrue(len(human.split('-')) == 16)
|
||||
|
||||
def test_safe_compare(self):
|
||||
self.assertTrue(crypto.cryptoutils.safe_compare('test', 'test'))
|
||||
|
|
Loading…
Reference in New Issue