forked from muXxer/recover-iota-seed-from-ledger-mnemonics
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmnemonics_to_iota_seed_romeo_wallet.py
67 lines (54 loc) · 2.21 KB
/
mnemonics_to_iota_seed_romeo_wallet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -*- coding: utf-8 -*-
import xxhash
from six.moves import input
from mnemonics_to_iota_seed import MnemonicsToIotaSeed, InputRecoveryWords, InputPassphrase
#===============================================================================
def InputRomeoAccount():
print("\nPlease enter your Romeo account now (number ranging from 0 to 999999999, or an arbitrary text):")
try:
romeo_account = input(" Romeo account: ")
try:
account = int(romeo_account)
except:
# Account is not an integer, hash the text with xxhash
x = xxhash.xxh32(seed=0xABCD)
x.update(romeo_account.upper().lstrip().rstrip())
account = x.intdigest()
if account >= 1000000000: # from 0 to 999999999
account_str = str(account)
account = int(account_str[0:9])
return account
except KeyboardInterrupt:
return None
#===============================================================================
def InputRomeoPageIndex():
print("\nPlease enter your Romeo page index now (it starts with index 1):")
try:
romeo_page = input(" Romeo page index: ")
page_index = int(romeo_page) - 1
if page_index < 0:
raise Exception("Invalid page index!")
return page_index
except KeyboardInterrupt:
return None
#===============================================================================
def RecoverRomeoSeed():
print("\nWelcome to IOTA Ledger Nano seed recovery for Romeo wallet!")
recovery_words = InputRecoveryWords()
if recovery_words == None:
return
passphrase = InputPassphrase()
if passphrase == None:
return
account = InputRomeoAccount()
if account == None:
return
page_index = InputRomeoPageIndex()
if page_index == None:
return
print("\nRomeo account Nr: %d" % (account))
print("Romeo page index: %d" % (page_index))
MnemonicsToIotaSeed(recovery_words, passphrase, bip44_account=account, bip44_page_index=page_index)
#===============================================================================
if __name__ == '__main__':
RecoverRomeoSeed()