eggcrypt 2.0.0__tar.gz → 2.1.0__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: 2.0.0
3
+ Version: 2.1.0
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,44 +1,17 @@
1
- def encrypt(txt, key, rep=0):
2
- encoded=""
3
- for i, ch in enumerate(txt):
4
- b=ord(ch)^ord(key[i%len(key)])
5
- for digit in str(b):
6
- encoded+=f"{int(digit)+200:03d}"
7
- out=""
8
- for i in range(0, len(encoded),2):
9
- chunk=encoded[i:i+2]
10
- if len(chunk)==2:
11
- out+=chr(int(chunk))
12
- else:
13
- out+=chr(int(chunk)*10)
14
- if rep:
15
- return out
16
- return encrypt(out,key,1)
17
- def decrypt(txt, key, rep=0):
18
- if rep==0:
19
- txt=decrypt(txt,key,1)
20
- encoded=""
1
+ def encrypt(txt,key):
2
+ data=""
3
+ for i,ch in enumerate(txt):
4
+ value=ord(ch)^ord(key[i%len(key)])
5
+ data+=f"{value:03d}"
6
+ return "".join(chr(int(data[i:i+3])) for i in range(0,len(data),3))
7
+ def decrypt(txt,key):
8
+ data=""
21
9
  for ch in txt:
22
- n=ord(ch)
23
- if n<100:
24
- encoded+=f"{n//10}"
25
- else:
26
- encoded+=f"{n:02d}"
27
- digits=""
28
- for i in range(0,len(encoded),3):
29
- part=encoded[i:i+3]
30
- if len(part)==3:
31
- digits+=str(int(part)-200)
32
- values=[]
33
- temp=""
34
- for d in digits:
35
- temp+=d
36
- if int(temp)>31:
37
- values.append(int(temp))
38
- temp=""
10
+ data+=f"{ord(ch):03d}"
39
11
  result=""
40
- for i, v in enumerate(values):
41
- result+=chr(v^ord(key[i%len(key)]))
12
+ nums=[int(data[i:i+3]) for i in range(0,len(data),3)]
13
+ for i,value in enumerate(nums):
14
+ result+=chr(value^ord(key[i%len(key)]))
42
15
  return result
43
16
  def key():
44
17
  import time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eggcrypt
3
- Version: 2.0.0
3
+ Version: 2.1.0
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 = "2.0.0"
7
+ version = "2.1.0"
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="2.0.0",
5
+ version="2.1.0",
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