Skip to content

Instantly share code, notes, and snippets.

@gceylan
Created May 25, 2011 09:41
Show Gist options
  • Save gceylan/990673 to your computer and use it in GitHub Desktop.
Save gceylan/990673 to your computer and use it in GitHub Desktop.
rot 13 şifreleme
#!/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