mmgen-wallet/scripts/compute-file-chksum.py
philemon 52fdf29b67
new classes: KeyGenerator,AddrGenerator,PrivKey; read-only attrs rewrite
- OO rewrite of key/addr generation interface (KeyGenerator,AddrGenerator)
- New data objects: PrivKey,PubKey,WifKey
- rewrite of read-only attr implementation for addr/tx/tw list entries
  (MMGenImmutableAttr,MMGenListItemAttr descriptors)
- txsign: build key list of addrlist objects rather than addr,key tuples
2017-08-07 22:02:24 +03:00

27 lines
737 B
Python
Executable file

#!/usr/bin/env python
import sys,os
repo_root = os.path.split(os.path.abspath(os.path.dirname(sys.argv[0])))[0]
sys.path = [repo_root] + sys.path
from mmgen.common import *
opts_data = lambda: {
'desc': 'Compute checksum for a MMGen data file',
'usage':'[opts] infile',
'options': """
-h, --help Print this help message.
-i, --include-first-line Include the first line of the file (you probably don't want this)
"""
}
cmd_args = opts.init(opts_data)
lines = get_lines_from_file(cmd_args[0])
start = (1,0)[bool(opt.include_first_line)]
a = make_chksum_6(' '.join(lines[start:]))
if start == 1:
b = lines[0]
m = ("Checksum in file (%s) doesn't match computed value!" % b,'Checksum in file OK')[a==b]
msg(m)
Msg(a)