Skip to content

Commit b20f18a

Browse files
author
BlockmasterPlayz
committed
Added a new project that encrypts any text you want
The project uses the ceaser cipher to encrypt/decrypt text in python
1 parent a8283e5 commit b20f18a

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

TextEncryptor/TextEncryptor.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#This application uses the ceaser cipher in order to encrypt text
2+
def encrypt(text):
3+
result = ""
4+
5+
for i in range(len(text)):
6+
char = text[i]
7+
8+
if char.isupper():
9+
result += chr((ord(char) + key - 65) % 26 + 65)
10+
elif char.islower():
11+
result += chr((ord(char) + key - 97) % 26 + 97)
12+
else:
13+
result += char
14+
15+
return result
16+
17+
def decrypt(text):
18+
result = ""
19+
20+
for i in range(len(text)):
21+
char = text[i]
22+
23+
if char.isupper():
24+
result += chr((ord(char) - decryptkey - 65) % 26 + 65)
25+
elif char.islower():
26+
result += chr((ord(char) - decryptkey - 97) % 26 + 97)
27+
else:
28+
result += char
29+
30+
return result
31+
32+
33+
choice = int(input("Would you like to encrypt some text or decrypt some text? Choose 1 to encrypt and 2 to decrypt "))
34+
if choice == 1:
35+
text = input("Input the text you want to encrypt: \n")
36+
key = int(input("Input the key for the encryption *NOTE! This is using the Ceaser cipher \n"))
37+
38+
result = encrypt(text)
39+
print(result)
40+
41+
elif choice == 2:
42+
text = input("Input the text you want to decrypt: \n")
43+
decryptkey = int(input("Input the key for the decryption *NOTE! This is using the Ceaser cipher \n"))
44+
45+
result = decrypt(text)
46+
print(result)
47+
48+
else:
49+
print("idk")

TextEncryptor/readme.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Script Title
2+
The text encryptor is a python mini project that allows the user to encrypt or decrypt any tet they wish using the ceaser cipher... With no GUI, it may not be the most intuitive, but I would like if someone could contribute and make a gui for this application in the future...
3+
4+
### Prerequisites
5+
Do not worry... there are no modules that are needed to run the project... just python itself...
6+
7+
### How to run the script
8+
just run the script and follow the instructions
9+
10+
### Screenshot/GIF showing the sample use of the script
11+
image.png
12+
13+
## *Author Name*
14+
BlockmasterPlayz

0 commit comments

Comments
 (0)