eggcrypt 3.0.0__tar.gz → 3.1.1__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.0.0 → eggcrypt-3.1.1}/PKG-INFO +1 -1
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/eggcrypt/egg.py +28 -35
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/eggcrypt.egg-info/PKG-INFO +1 -1
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/pyproject.toml +1 -1
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/setup.py +1 -1
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/LICENSE +0 -0
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/README.md +0 -0
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/eggcrypt/__init__.py +0 -0
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/eggcrypt.egg-info/SOURCES.txt +0 -0
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/eggcrypt.egg-info/dependency_links.txt +0 -0
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/eggcrypt.egg-info/top_level.txt +0 -0
- {eggcrypt-3.0.0 → eggcrypt-3.1.1}/setup.cfg +0 -0
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
for
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
h=0
|
|
26
|
-
for c in o:
|
|
27
|
-
h^=ord(c)
|
|
28
|
-
h=((h<<13)|(h >> 243))&((1<<256)-1)
|
|
29
|
-
h=(h*0x9e3779b97f4a7c15)&((1<<256)-1)
|
|
30
|
-
chars="0123456789abcdefghijklmnopqrstuvwxyz"
|
|
31
|
-
x=""
|
|
32
|
-
while h:x=chars[h%36]+x;h//=36
|
|
33
|
-
out=x.zfill(50)
|
|
34
|
-
return out
|
|
1
|
+
from functools import lru_cache
|
|
2
|
+
def hash2(txt):
|
|
3
|
+
txt=str(txt)
|
|
4
|
+
data=txt.encode()
|
|
5
|
+
m=0xFFFFFFFFFFFFFFFF
|
|
6
|
+
h=0x9E3779B97F4A7C15^len(data)
|
|
7
|
+
i=0
|
|
8
|
+
while i+8<=len(data):
|
|
9
|
+
x=int.from_bytes(data[i:i+8],"little")
|
|
10
|
+
h^=x*0x9E3779B185EBCA87&m
|
|
11
|
+
h=((h<<31)|(h>>33))&m
|
|
12
|
+
h*=0xC2B2AE3D27D4EB4F&m
|
|
13
|
+
i+=8
|
|
14
|
+
x=0
|
|
15
|
+
for j,b in enumerate(data[i:]):
|
|
16
|
+
x|=b<<(j*8)
|
|
17
|
+
h^=x*0x165667B19E3779F9&m
|
|
18
|
+
h^=h>>33
|
|
19
|
+
h=h*0xFF51AFD7ED558CCD&m
|
|
20
|
+
h^=h>>33
|
|
21
|
+
h=h*0xC4CEB9FE1A85EC53&m
|
|
22
|
+
h^=h>>33
|
|
23
|
+
return str(h)
|
|
24
|
+
@lru_cache(maxsize=512)
|
|
35
25
|
def makesbox(key):
|
|
36
26
|
prev=hash2(key)
|
|
37
27
|
stream=[]
|
|
@@ -80,6 +70,7 @@ def undiffuse2(data):
|
|
|
80
70
|
def round_sbox(key,r):
|
|
81
71
|
round_key=xor_text(str(key),hash2(str(key)+str(r*0x9E3779B97F4A7C15)))
|
|
82
72
|
return makesbox(round_key)
|
|
73
|
+
@lru_cache(maxsize=512)
|
|
83
74
|
def roundkey(key,r):
|
|
84
75
|
return int(hash2(str(key)+str(r*0x9E3779B97F4A7C15)),36)
|
|
85
76
|
def permute(data, perm):
|
|
@@ -90,6 +81,7 @@ def make_perm(n, key=7):
|
|
|
90
81
|
x=key&0x7fffffff
|
|
91
82
|
for _ in range(n):
|
|
92
83
|
x=(x*1103515245+12345)&0x7fffffff
|
|
84
|
+
x=int.from_bytes(xor_text(str(x),hash2(x*0x9E3779B185EBCA87)).encode(),"big")
|
|
93
85
|
pos=x%n
|
|
94
86
|
while pos in used:
|
|
95
87
|
pos=(pos+1)%n
|
|
@@ -117,8 +109,9 @@ def encrypt(txt,key):
|
|
|
117
109
|
txt=diffuse2(txt)
|
|
118
110
|
final_perm =make_perm(len(txt), roundkey(key,999))
|
|
119
111
|
txt=permute(txt,final_perm)
|
|
120
|
-
return txt
|
|
112
|
+
return txt.encode("utf-8").hex()
|
|
121
113
|
def decrypt(txt,key):
|
|
114
|
+
txt=bytes.fromhex(txt).decode("utf-8")
|
|
122
115
|
final_perm=make_perm(len(txt),roundkey(key,999))
|
|
123
116
|
txt=permute(txt,inverse_perm(final_perm))
|
|
124
117
|
txt=undiffuse2(txt)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "eggcrypt"
|
|
7
|
-
version = "3.
|
|
7
|
+
version = "3.1.1"
|
|
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
|