addrgen,keygen: use internal ed25519 module by user request

This commit is contained in:
The MMGen Project 2018-02-24 21:43:55 +03:00
commit 282fec8054
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
4 changed files with 20 additions and 8 deletions

View file

@ -129,6 +129,7 @@ class AddrGeneratorMonero(AddrGenerator):
# ed25519ll, a low-level ctypes wrapper for Ed25519 digital signatures by
# Daniel Holth <dholth@fastmail.fm> - http://bitbucket.org/dholth/ed25519ll/
try:
assert not opt.use_internal_ed25519_mod
from ed25519ll.djbec import scalarmult,edwards,encodepoint,B
except:
from mmgen.ed25519 import scalarmult,edwards,encodepoint,B

0
mmgen/ed25519.py Normal file → Executable file
View file

View file

@ -35,7 +35,7 @@ if sys.argv[0].split('-')[-1] == 'keygen':
else:
gen_what = 'addresses'
gen_desc = 'addresses'
opt_filter = 'hbcdeiHOKlpzPqrStv-'
opt_filter = 'hbcdeEiHOKlpzPqrStv-'
note_addrkey = ''
note_secp256k1 = """
If available, the secp256k1 library will be used for address generation.
@ -53,6 +53,8 @@ opts_data = lambda: {
-c, --print-checksum Print address list checksum and exit
-d, --outdir= d Output files to directory 'd' instead of working dir
-e, --echo-passphrase Echo passphrase or mnemonic to screen upon entry
-E, --use-internal-ed25519-mod Use (slow) internal ed25519 module for Monero
address generation, even if ed25519ll is installed
-i, --in-fmt= f Input is from wallet format 'f' (see FMT CODES below)
-H, --hidden-incog-input-params=f,o Read hidden incognito data from file
'f' at offset 'o' (comma-separated)
@ -121,6 +123,10 @@ errmsg = "'{}': invalid parameter for --type option".format(opt.type)
addr_type = MAT(opt.type or g.proto.dfl_mmtype,errmsg=errmsg)
if len(cmd_args) < 1: opts.usage()
if opt.use_internal_ed25519_mod:
msg('Using (slow) internal ed25519 module by user request')
idxs = AddrIdxList(fmt_str=cmd_args.pop())
sf = get_seed_file(cmd_args,1)

View file

@ -188,14 +188,19 @@ i_monero='Monero'
s_monero='Testing generation and wallet creation operations for Monero'
s_monero='The monerod (mainnet) daemon must be running for the following tests'
t_monero=(
"$mmgen_keygen --accept-defaults --outdir $TMPDIR --coin=xmr test/ref/98831F3A.mmwords $monero_addrs"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR keyaddrlist2monerowallets $TMPDIR/988*XMR*akeys addrs=23"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR keyaddrlist2monerowallets $TMPDIR/988*XMR*akeys addrs=103-200"
"mmgen-walletgen -q -r0 -p1 -Llabel --outdir $TMPDIR -o words"
"$mmgen_keygen -q --accept-defaults --outdir $TMPDIR --coin=xmr $TMPDIR/*.mmwords $monero_addrs"
'cs1=$(mmgen-tool -q --accept-defaults --coin=xmr keyaddrfile_chksum $TMPDIR/*-XMR*.akeys)'
"$mmgen_keygen -q --use-internal-ed25519-mod --accept-defaults --outdir $TMPDIR --coin=xmr $TMPDIR/*.mmwords $monero_addrs"
'cs2=$(mmgen-tool -q --accept-defaults --coin=xmr keyaddrfile_chksum $TMPDIR/*-XMR*.akeys)'
'[ "$cs1" == "$cs2" ] || false'
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR keyaddrlist2monerowallets $TMPDIR/*-XMR*.akeys addrs=23"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR keyaddrlist2monerowallets $TMPDIR/*-XMR*.akeys addrs=103-200"
'rm $TMPDIR/*-MoneroWallet*'
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR keyaddrlist2monerowallets $TMPDIR/988*XMR*akeys"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR syncmonerowallets $TMPDIR/988*XMR*akeys addrs=3"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR syncmonerowallets $TMPDIR/988*XMR*akeys addrs=23-29"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR syncmonerowallets $TMPDIR/988*XMR*akeys"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR keyaddrlist2monerowallets $TMPDIR/*-XMR*.akeys"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR syncmonerowallets $TMPDIR/*-XMR*.akeys addrs=3"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR syncmonerowallets $TMPDIR/*-XMR*.akeys addrs=23-29"
"$mmgen_tool -q --accept-defaults --outdir $TMPDIR syncmonerowallets $TMPDIR/*-XMR*.akeys"
)
[ "$MINGW" ] && t_monero=("$t_monero")
f_monero='Monero tests completed'