SourceCode_8.py 857 B

1234567891011121314151617181920
  1. def Decrypt(self, textToDecrypt): # Anything other than a string input will break this
  2. location = 0
  3. decryptedText = ""
  4. offsetIndex = 0
  5. nextwhitespace = 0
  6. while location < len(textToDecrypt):
  7. if offsetIndex < 9:
  8. offsetIndex += 1
  9. elif offsetIndex == 9:
  10. offsetIndex = 0
  11. nextwhitespace = textToDecrypt.find(" ", location)
  12. if nextwhitespace != -1:
  13. tempTextToDecrypt = textToDecrypt[location:nextwhitespace]
  14. offsetValue = encryptionList[offsetIndex]
  15. finalText = chr(int(tempTextToDecrypt) - int(offsetValue))
  16. decryptedText += finalText
  17. if nextwhitespace < location:
  18. return decryptedText
  19. else:
  20. location = nextwhitespace + 1