Advertisement
Guest User

t.me/not_statilko

a guest
Jul 22nd, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. class Ascii_Cip:
  2.     def cipher(string,password):
  3.         indx = 0
  4.         end_cip = ""
  5.         for all in string:
  6.             if len(password) == indx:
  7.                 indx = 0
  8.             part = str(ord(all) +
  9.                 ord(password[indx])) + "|"
  10.             indx += 1
  11.             end_cip += part
  12.         return end_cip
  13.            
  14.            
  15.     def decipher(encrypt,password):
  16.         indx = 0
  17.         end_decip = ""
  18.         number = ""
  19.         while encrypt != "":
  20.             for all in encrypt:
  21.                 if len(password) == indx:
  22.                     indx = 0
  23.                 if all != "|":            
  24.                     number += all
  25.                 elif all == "|":
  26.                     encrypt = encrypt[len(number)+1:]
  27.                     end_decip += chr(int(number) -
  28.                     ord(password[indx]))
  29.                     indx += 1
  30.                     number = ""
  31.         return end_decip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement