code: def scramble_string(s, key):
      
      key = key_digits(key)
      for k in key:          # foreach digit in the key
          s = shift(s, key)  # for each char by each digit in the key in sequence
          s = s[k:] + s[:k]  # cut the sequence around the key digit
          s = shuffle(s)     # do a 1:1 shuffle of the 'deck'
  
      return s
docs: s is the puzzle's solution in column-major order, omitting black squares:
      i.e. if the puzzle is:
          C A T
          # # A
          # # R
      solution is CATAR
  
  
      Key is a 4-digit number in the range 1000 <= key <= 9999