eggcrypt 3.1.0__tar.gz → 3.1.2__tar.gz
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.
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/PKG-INFO +1 -1
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/eggcrypt/egg.py +6 -1
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/eggcrypt.egg-info/PKG-INFO +1 -1
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/pyproject.toml +1 -1
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/setup.py +1 -1
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/LICENSE +0 -0
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/README.md +0 -0
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/eggcrypt/__init__.py +0 -0
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/eggcrypt.egg-info/SOURCES.txt +0 -0
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/eggcrypt.egg-info/dependency_links.txt +0 -0
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/eggcrypt.egg-info/top_level.txt +0 -0
- {eggcrypt-3.1.0 → eggcrypt-3.1.2}/setup.cfg +0 -0
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
from functools import lru_cache
|
|
2
|
+
def replace_non_255(text):
|
|
3
|
+
return ''.join(c if ord(c)<=255 else '?' for c in text)
|
|
2
4
|
def hash2(txt):
|
|
3
5
|
txt=str(txt)
|
|
4
6
|
data=txt.encode()
|
|
@@ -94,6 +96,7 @@ def inverse_perm(perm):
|
|
|
94
96
|
inv[old_pos]=new_pos
|
|
95
97
|
return inv
|
|
96
98
|
def encrypt(txt,key):
|
|
99
|
+
txt=replace_non_255(txt)
|
|
97
100
|
for r in range(10):
|
|
98
101
|
txt=xor_text(txt,roundkey(key,r))
|
|
99
102
|
sbox=round_sbox(key,r)
|
|
@@ -109,8 +112,10 @@ def encrypt(txt,key):
|
|
|
109
112
|
txt=diffuse2(txt)
|
|
110
113
|
final_perm =make_perm(len(txt), roundkey(key,999))
|
|
111
114
|
txt=permute(txt,final_perm)
|
|
112
|
-
return txt
|
|
115
|
+
return txt.encode("utf-8").hex()
|
|
113
116
|
def decrypt(txt,key):
|
|
117
|
+
txt=replace_non_255(txt)
|
|
118
|
+
txt=bytes.fromhex(txt).decode("utf-8")
|
|
114
119
|
final_perm=make_perm(len(txt),roundkey(key,999))
|
|
115
120
|
txt=permute(txt,inverse_perm(final_perm))
|
|
116
121
|
txt=undiffuse2(txt)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "eggcrypt"
|
|
7
|
-
version = "3.1.
|
|
7
|
+
version = "3.1.2"
|
|
8
8
|
description = "A pretty secure (yet inneficient) encryption program. Has key(), hash(), encrypt() and decrypt()."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|