Created
May 25, 2011 09:41
-
-
Save gceylan/990673 to your computer and use it in GitHub Desktop.
rot 13 şifreleme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
def sifreLe(sifrelenecek_dosya, sifreli_dosya): | |
dosya = open(sifrelenecek_dosya, 'r') | |
sifreli = open(sifreli_dosya, 'w') | |
while True: | |
sifre = dosya.readline(50) | |
for i in sifre: | |
if sifre == '': | |
break | |
if ord(i) <= 109: | |
sifreli.write(chr(ord(i) + 13)) | |
else: | |
sifreli.write(chr(ord(i) - 13)) | |
dosya.close() | |
sifreli.close() | |
return | |
def sifre_coz(adi, yeri): | |
dosya = open(adi, 'r') | |
cozulmus = open(yeri, 'w') | |
while True: | |
sifre = dosya.read(50) | |
for i in sifre: | |
if sifre == '': | |
break | |
if ord(i) <= 109: | |
cozulmus.write(chr(ord(i) + 13)) | |
else: | |
cozulmus.write(chr(ord(i) - 13)) | |
dosya.close() | |
cozulmus.close() | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment