eggcrypt 3.0.0__tar.gz → 3.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: 3.0.0
3
+ Version: 3.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,37 +1,27 @@
1
- def hash2(inp):
2
- inp=str(inp)
3
- H=[0x243f6a8885a308d3,0x13198a2e03707344,0xa4093822299f31d0,0x082efa98ec4e6c89]
4
- for i,c in enumerate(inp):
5
- x=ord(c)+(i<<8)
6
- j=i%4
7
- H[j]^=x
8
- H[j]=(H[j]*0x100000001b3)&0xffffffffffffffff
9
- H[(j+1)%4]^=H[j]>>17
10
- key_str=''.join(f'{x:016x}' for x in H)
11
- tot=sum((i+1)*ord(c) for i,c in enumerate(key_str))
12
- for i in inp:
13
- tot^=ord(i)
14
- out=""
15
- for i in key_str:
16
- v=int(i,16)
17
- out+=str(v+((tot*v)%256))
18
- o=""
19
- for i in out:o+=chr((int(i)+tot)%256)
20
- out=""
21
- for i in range(len(o)-1):out+=str(i*tot+ord(o[i]))
22
- for n in map(int,[out[i:i+2] for i in range(0,len(out),2)]):o+=chr(n+32)
23
- if len(out)%2:o+=chr(int(out[-1])*21)
24
- o=o.lstrip("0123456789")
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eggcrypt
3
- Version: 3.0.0
3
+ Version: 3.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 = "3.0.0"
7
+ version = "3.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="3.0.0",
5
+ version="3.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