Question 1: A Python solution
map = {} for line in open('01-cipher'): if '+---+----+' in line or line.isspace(): continue elif '|' in line: old = line[26] hex = line[30:32] map[ord(old)] = int(hex, 16) else: print(line.translate(map), end="")
map = {} for line in open('01-cipher'): if '+---+----+' in line or line.isspace(): continue elif '|' in line: old = line[26] hex = line[30:32] map[ord(old)] = int(hex, 16) else: print(line.translate(map), end="")