Skip to content

Commit

Permalink
Release Candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
maccaspacca committed Oct 27, 2018
1 parent d38f62e commit f1c25aa
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 35 deletions.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,4 @@ Usage: python read_paper_bis.python

Make sure you have the mnemonic seed available and type in when prompted. If you used a passphrase when you created the wallet then also enter this when prompted.

The files are created in a folder named with the address name.

test.py

This can be used to test the key creation and regeneration code.

Usage: python test.py

100 addresses are generated deterministically. The deterministic word list is then used again and the resulting address compaired with the original.

If the addresses are the same then we have success

The test should result in 100% success
The files are created in a folder named with the address name.
Binary file removed icon_old.png
Binary file not shown.
6 changes: 3 additions & 3 deletions read_paper_bis.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
Bismuth Paper Wallet Seed Reader
Version 0.2 Test Version
Date 26/04/2018
Version 0.3 Release Candidate
Date 26/10/2018
Copyright maccaspacca and jimhsu 2018
Copyright The Bismuth Foundation 2016 to 2018
Author Maccaspacca
Reads the 24-word mnemonic seed from the paper wallet and recreates the address and the wallet.der files
Usage - python read_paper_bis.python
Usage - python read_paper_bis.py
make sure you have the mnemonic seed available and type in when prompted
if you used a passphrase when you created the wallet then enter this when prompted
the files are created in a folder named with the address name
Expand Down
48 changes: 29 additions & 19 deletions write_paper_bis.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Bismuth Paper Wallet Generator
Version 0.4 Test Version
Date 26/04/2018
Version 0.5 Release Candidate
Date 26/10/2018
Copyright maccaspacca and jimhsu 2018
Copyright The Bismuth Foundation 2016 to 2018
Author Maccaspacca
Expand Down Expand Up @@ -130,32 +130,42 @@ def footer(self):

# key generation

address = ""
pwd_a = mnemo.generate(strength=256)
m_ken = False

app_log.info("Mnemonic (seed) = {}".format(pwd_a))
passphrase = input("Enter optional passphrase (hit return for empty): ")
opt_msg = input("Enter optional front page message (hit return for empty): ")
passP = "mnemonic" + passphrase
while not m_ken: # catch a bad seed

master_key = PBKDF2(pwd_a.encode('utf-8'), passP.encode('utf-8'), dkLen=length, count=iterations)
#print("Master key: " + str(base64.b64encode(master_key)))
try:
address = ""
pwd_a = mnemo.generate(strength=256)

app_log.info("Mnemonic (seed) = {}".format(pwd_a))
passphrase = input("Enter optional passphrase (hit return for empty): ")
opt_msg = input("Enter optional front page message (hit return for empty): ")
passP = "mnemonic" + passphrase

deriv_path = "m/44'/"+ str(cointype) +"'/" + str(aid) + "'/0/" + str(addrs) #HD path
master_key = PBKDF2(pwd_a.encode('utf-8'), passP.encode('utf-8'), dkLen=length, count=iterations)
#print("Master key: " + str(base64.b64encode(master_key)))

account_key = PBKDF2(master_key, deriv_path.encode('utf-8'), dkLen=length, count=1)
#print("Account key: " + str(base64.b64encode(account_key)))
deriv_path = "m/44'/"+ str(cointype) +"'/" + str(aid) + "'/0/" + str(addrs) #HD path

rsa = rsa_functions.RSAPy(n,account_key)
key = RSA.construct(rsa.keypair)
account_key = PBKDF2(master_key, deriv_path.encode('utf-8'), dkLen=length, count=1)
#print("Account key: " + str(base64.b64encode(account_key)))

private_key_readable = key.exportKey().decode("utf-8")
public_key_readable = key.publickey().exportKey().decode("utf-8")
address = hashlib.sha224(public_key_readable.encode("utf-8")).hexdigest() # hashed public key
rsa = rsa_functions.RSAPy(n,account_key)
key = RSA.construct(rsa.keypair)

private_key_readable = key.exportKey().decode("utf-8")
public_key_readable = key.publickey().exportKey().decode("utf-8")
address = hashlib.sha224(public_key_readable.encode("utf-8")).hexdigest() # hashed public key
app_log.info("Seed and address created successfully")
m_ken = True

except Exception as e:
app_log.warning('Key Generation error: {}'.format(e))
m_ken = False

pathlib.Path(address).mkdir(parents=True, exist_ok=True) # create folder to store the files

app_log.info('Generating address: ' + address)
# generate key pair and an address

pwd_qr = pyqrcode.create(pwd_a)
Expand Down

0 comments on commit f1c25aa

Please sign in to comment.