12345678910111213141516171819202122 |
- def Encrypt(self, textToEncrypt):
- location = 0
- encryptedText = []
- offsetIndex = 0
- while location < len(textToEncrypt):
- if offsetIndex < 9: # Let's make sure we keep it in-bounds.
- offsetIndex += 1
- elif offsetIndex == 9:
- offsetIndex = 0
- charValue = ord(textToEncrypt[location])
- offsetValue = encryptionList[offsetIndex]
- finalValue = int(charValue) + int(offsetValue)
- encryptedText.append(str(finalValue))
- location += 1
- location = 0
- finalString = ""
- while location < len(encryptedText):
- finalString += str(encryptedText[location])
- if location != len(encryptedText):
- finalString += " "
- location += 1
- return finalString
|