Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Ascii_Cip:
- def cipher(string,password):
- indx = 0
- end_cip = ""
- for all in string:
- if len(password) == indx:
- indx = 0
- part = str(ord(all) +
- ord(password[indx])) + "|"
- indx += 1
- end_cip += part
- return end_cip
- def decipher(encrypt,password):
- indx = 0
- end_decip = ""
- number = ""
- while encrypt != "":
- for all in encrypt:
- if len(password) == indx:
- indx = 0
- if all != "|":
- number += all
- elif all == "|":
- encrypt = encrypt[len(number)+1:]
- end_decip += chr(int(number) -
- ord(password[indx]))
- indx += 1
- number = ""
- return end_decip
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement