fork download
  1. def encrypt(plain, cipher, text):
  2. plain += plain.upper()
  3. cipher += cipher.upper()
  4.  
  5. newText = ''
  6. for c in text:
  7. index = plain.find(c)
  8. if(index >= 0 and index < len(cipher)):
  9. newText += cipher[index]
  10. else:
  11. newText += c
  12.  
  13. return newText;
  14.  
  15. plainAlphabet = "abcdefghijklmnopqrstuvwxyz"
  16. cipherAlphabet = "zyxwvutsrqponmlkjihgfedcba"
  17. text = "Some sensitive text that only humans must be able to read"
  18.  
  19. encodedText = encrypt(plainAlphabet, cipherAlphabet, text);
  20. print encodedText
Success #stdin #stdout 0.01s 7736KB
stdin
Standard input is empty
stdout
Hlnv hvmhrgrev gvcg gszg lmob sfnzmh nfhg yv zyov gl ivzw