Cencrypt 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Cencrypt/Cencrypt.py.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import random
|
|
2
|
+
|
|
3
|
+
LETTERS = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," ",
|
|
4
|
+
"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z",".",
|
|
5
|
+
",","/","[","]","`","~","\\","1","2","3","4","5","6","7","8","9","0","-","+","=","!","@","#","$","%","^","&",
|
|
6
|
+
"*","(",")","<",">","?","|",";",";",":","'","\"","{","}"]
|
|
7
|
+
|
|
8
|
+
def index_find(key):
|
|
9
|
+
j = 0
|
|
10
|
+
for i in LETTERS:
|
|
11
|
+
if key == i:
|
|
12
|
+
break
|
|
13
|
+
else:
|
|
14
|
+
j = j + 1
|
|
15
|
+
return j
|
|
16
|
+
|
|
17
|
+
def cipher(message):
|
|
18
|
+
striped_message = message
|
|
19
|
+
num = random.randint(1, (len(striped_message)-1))
|
|
20
|
+
key = striped_message[num]
|
|
21
|
+
j = index_find(key)
|
|
22
|
+
split_letters = [let for let in striped_message]
|
|
23
|
+
i = 0
|
|
24
|
+
for l in split_letters:
|
|
25
|
+
split_letters[i] = index_find(l)
|
|
26
|
+
i = i + 1
|
|
27
|
+
|
|
28
|
+
for i in range(len(split_letters)):
|
|
29
|
+
split_letters[i] = (split_letters[i] + j) % len(LETTERS)
|
|
30
|
+
|
|
31
|
+
for num in range(len(split_letters)):
|
|
32
|
+
split_letters[num] = LETTERS[split_letters[num]]
|
|
33
|
+
|
|
34
|
+
new_message = "".join(split_letters)
|
|
35
|
+
sent_key = LETTERS[j]
|
|
36
|
+
|
|
37
|
+
return new_message, sent_key
|
|
38
|
+
|
|
39
|
+
def decipher(message):
|
|
40
|
+
spl_message = [let for let in message]
|
|
41
|
+
key = spl_message[0]
|
|
42
|
+
spl_message.pop(0)
|
|
43
|
+
message = "".join(spl_message)
|
|
44
|
+
j = index_find(key)
|
|
45
|
+
|
|
46
|
+
split_ciphered = [let for let in message]
|
|
47
|
+
i = 0
|
|
48
|
+
for l in split_ciphered:
|
|
49
|
+
split_ciphered[i] = index_find(l)
|
|
50
|
+
i = i + 1
|
|
51
|
+
|
|
52
|
+
for i in range(len(split_ciphered)):
|
|
53
|
+
split_ciphered[i] = (split_ciphered[i] - j) % len(LETTERS)
|
|
54
|
+
|
|
55
|
+
for num in range(len(split_ciphered)):
|
|
56
|
+
split_ciphered[num] = LETTERS[split_ciphered[num]]
|
|
57
|
+
|
|
58
|
+
deciphered_message = "".join(split_ciphered)
|
|
59
|
+
|
|
60
|
+
return deciphered_message
|
Cencrypt/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .Cencrypt import cipher, decipher
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Cencrypt/Cencrypt.py.py,sha256=G9C-O2qlZLSCqDVMdY8iVu3lcsSdndtA6LeYiKMPp6U,1866
|
|
2
|
+
Cencrypt/__init__.py,sha256=hq7NUQLKuMN17macp1mQmaUs6adCQPZKBFmm1tvINSE,38
|
|
3
|
+
cencrypt-0.1.0.dist-info/METADATA,sha256=BLcK4KBXhTwRghf8blc5wVmvB5t8ObN4_fttEViC7eU,217
|
|
4
|
+
cencrypt-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
5
|
+
cencrypt-0.1.0.dist-info/top_level.txt,sha256=f1mhbMDB3KJHZNWJbGeajq_ywalRuy0MXXh_mCQCFqo,9
|
|
6
|
+
cencrypt-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Cencrypt
|