Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def transencrypt(word,key):
- count1=0
- count2=0
- encrypted=''
- encryptbox=['']*key
- while count1<key:
- count2=count1
- while count2<len(word):
- encryptbox[count1]+=word[count2]
- count2+=key
- encrypted+=encryptbox[count1]
- count1+=1
- return encrypted
- def transdecrypt(word,key):
- import math
- count1=0
- count2=0
- decrypted=''
- col=int(math.ceil(len(word)/key))
- decryptbox=['']*col
- while count1<col:
- count2=count1
- while count2<len(word):
- decryptbox[count1]+=word[count2]
- count2+=col
- decrypted+=decryptbox[count1]
- count1+=1
- return decrypted
- print(transencrypt('hello world',5))
- print(transdecrypt('h dewlolrol',5))
Add Comment
Please, Sign In to add comment