Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def cipher(string, shift):
- output = ""
- for letter in string:
- output += chr(ord(letter)+shift)
- return output;
- def decipher(string, shift):
- return cipher(string, -shift)
- def main():
- string = "Ala ma kota, sierotka ma rysia"
- shift = 5
- print "Tekst do zaszyfrowania: " + string
- string = cipher(string, shift)
- print "Tekst zaszyfrowany: " + string
- string = decipher(string, shift)
- print "Tekst odszyfrowany: " + string
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment