eggcrypt 3.1.1__tar.gz → 3.1.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eggcrypt
3
- Version: 3.1.1
3
+ Version: 3.1.3
4
4
  Summary: A pretty secure (yet inneficient) encryption program. Has key(), hash(), encrypt() and decrypt().
5
5
  Author: Egglord
6
6
  License: MIT
@@ -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)
@@ -111,6 +114,7 @@ def encrypt(txt,key):
111
114
  txt=permute(txt,final_perm)
112
115
  return txt.encode("utf-8").hex()
113
116
  def decrypt(txt,key):
117
+ txt=replace_non_255(txt)
114
118
  txt=bytes.fromhex(txt).decode("utf-8")
115
119
  final_perm=make_perm(len(txt),roundkey(key,999))
116
120
  txt=permute(txt,inverse_perm(final_perm))
@@ -131,15 +135,16 @@ def decrypt(txt,key):
131
135
  out+=chr(inv[ord(ch)])
132
136
  txt=xor_text(out,roundkey(key,r))
133
137
  return txt
134
- def key():
138
+ def key(seed):
135
139
  import time
136
- seed=1
140
+ seed=int(str(seed).lstrip("-"))
137
141
  for i in range(int(time.time()*10000)%100):
138
142
  a=str(time.time()*10000)
139
143
  a=a[0:10]
140
144
  a=int(a)
141
145
  seed=int(seed*a+(round(seed^a)))
142
- return seed
146
+
147
+ return hash(hash2(seed))
143
148
  def hash(inp):
144
149
  inp=str(inp)
145
150
  H=[0x243f6a8885a308d3,0x13198a2e03707344,0xa4093822299f31d0,0x082efa98ec4e6c89]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eggcrypt
3
- Version: 3.1.1
3
+ Version: 3.1.3
4
4
  Summary: A pretty secure (yet inneficient) encryption program. Has key(), hash(), encrypt() and decrypt().
5
5
  Author: Egglord
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "eggcrypt"
7
- version = "3.1.1"
7
+ version = "3.1.3"
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"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="egg",
5
- version="3.1.1",
5
+ version="3.1.3",
6
6
  packages=find_packages(),
7
7
  description="A pretty secure (yet inneficient) encryption program.",
8
8
  author="Egglord",
File without changes
File without changes
File without changes
File without changes