CSC 15 Lab 8 : File Descrambling --------------------------- Part I: ----------------------------- The purpose of the first part of the assignment is to descramble a file that has been posted on the homepage along with its encryption key. The encryption key is in the form of a permutation. For example, if the first (0th) number of permutation is 45, then the first letter of the original file is stored as the 46th letter in the scrambled file. If the file is longer than the permutation, then the file is scrambled in segments, each segment is equal to the size of the permutation. You are to write a function descramble(scrambledfile,keyfile) That reads the scrambled file into a string, desramble the string using the key, then write the descrambled file to a new file, something with a ".descrambled" suffix Here's some code you can use in your program: ------------ # reads permutation from file, returns array representation def readkey(fname): P = [] fd = open(fname,"r") # opens file for reading S = "dfs" # some non-empty string while S!= "": # S will be "" at end of file S = fd.readline() # read one line if S!="": P.append( int(S) ) # ends while loop fd.close() return P # returns array representing a permutation # readkey #### Here are some other functions you may need: # Function to convert between strings and arrays of chars # For example, stringtoarray("abc") returns ["a","b","c"] # and arraytostring(["a","b","c"]) returns "abc" def stringtoarray(S): A = [] i = 0 while i