def reconstitute_interface(args): p,k,first,second,manual_input = [],999,True,True,False # Gather up a list of n-pieces, with some moderately complex UI logic # to help the user along # Grammar: python main.py --reconstitute [piece 1] ... [piece n] [format] if len(args) == 0: while len(p) < k: if len(args) == 0: # The first time that we have information on k AND it's the user input # ting manually, print the "$1 total pieces required, $2 to go" string if len(p) > 0 and second: k = (bitcoin.trial_and_error_decode(p[0]) / (256 ** 37)) % 256 - 147 print "%d total pieces required, %d to go" % (k, k-len(p)) second = False if first: print "Enter the key parts:" v = raw_input("> ") manual_input = True else: v = args.pop(0) p.append(v) if first and manual_input: first = False # We have to do this at the end of the first round since the k # parameter might actually be 1, in which case we should end the # while loop after this immediately k = (bitcoin.trial_and_error_decode(p[0]) / (256 ** 37)) % 256 - 147 # Too many pieces inputted, don't interpret an extra piece as the base # parameter while len(args) > 0 and get_format(args[0]) == -1: args.pop(0) if len(args) == 0: args.append(raw_input( "Please enter format: integer(10), hexadecimal(16) " + \ "or base58check wallet import format (58): ")) print bitcoin.reconstitute(p,get_format(args[0]))
def reconstitute_interface(args): p, k, first, second, manual_input = [], 999, True, True, False # Gather up a list of n-pieces, with some moderately complex UI logic # to help the user along # Grammar: python main.py --reconstitute [piece 1] ... [piece n] [format] if len(args) == 0: while len(p) < k: if len(args) == 0: # The first time that we have information on k AND it's the user input # ting manually, print the "$1 total pieces required, $2 to go" string if len(p) > 0 and second: k = (bitcoin.trial_and_error_decode(p[0]) / (256**37)) % 256 - 147 print "%d total pieces required, %d to go" % (k, k - len(p)) second = False if first: print "Enter the key parts:" v = raw_input("> ") manual_input = True else: v = args.pop(0) p.append(v) if first and manual_input: first = False # We have to do this at the end of the first round since the k # parameter might actually be 1, in which case we should end the # while loop after this immediately k = (bitcoin.trial_and_error_decode(p[0]) / (256**37)) % 256 - 147 # Too many pieces inputted, don't interpret an extra piece as the base # parameter while len(args) > 0 and get_format(args[0]) == -1: args.pop(0) if len(args) == 0: args.append(raw_input( "Please enter format: integer(10), hexadecimal(16) " + \ "or base58check wallet import format (58): ")) print bitcoin.reconstitute(p, get_format(args[0]))
def split_interface(args): # Splits a key # Grammar: python main.py --split [privkey] [n] [k (1<=k<=n)] if len(args) == 0: args.append(bitcoin.trial_and_error_decode(raw_input( "Enter private key (any format): "))) if len(args) == 1: args.append(raw_input( "How many parts do you want to split your key into? (1-14): ")) if len(args) == 2: args.append(raw_input( "How many parts should be required to reconstitute your " + \ "key? (1-%d): " % int(args[1]))) v = bitcoin.split(args[0],int(args[2]),int(args[1])) print "Write down the key parts:" for i in v: print i
def split_interface(args): # Splits a key # Grammar: python main.py --split [privkey] [n] [k (1<=k<=n)] if len(args) == 0: args.append( bitcoin.trial_and_error_decode( raw_input("Enter private key (any format): "))) if len(args) == 1: args.append( raw_input( "How many parts do you want to split your key into? (1-14): ")) if len(args) == 2: args.append(raw_input( "How many parts should be required to reconstitute your " + \ "key? (1-%d): " % int(args[1]))) v = bitcoin.split(args[0], int(args[2]), int(args[1])) print "Write down the key parts:" for i in v: print i