Simple example of encryption text

simple encryption.py

# Sample Python/Pygame Programs
# http://simpson.edu/computer-science/
 
plain_text = "This is a test. ABC abc"

encrypted_text = ""
for c in plain_text:
    x = ord(c)
    x = x + 1
    c2 = chr(x)
    encrypted_text = encrypted_text + c2
print(encrypted_text)

Simple example of decryption text

simple decryption.py

# Simpson College Computer Science
# http://simpson.edu/computer-science/
 
encrypted_text = "Uijt!jt!b!uftu/!BCD!bcd"
 
plain_text = ""
for c in encrypted_text:
    x = ord(c)
    x = x - 1
    c2 = chr(x)
    plain_text = plain_text + c2
print(plain_text)

 

source,source,edu

Advertisement

Leave a reply

Please enter your comment!
Please enter your name here