sha-1024 1.0.0__py3-none-any.whl

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.
sha_1024/__init__.py ADDED
@@ -0,0 +1,4 @@
1
+ from . import sha1024
2
+ __doc__ = sha1024.__doc__
3
+ copyright = sha1024.copyright
4
+ __all__ = sha1024.__all__
sha_1024/sha1024.py ADDED
@@ -0,0 +1,187 @@
1
+ import secrets
2
+ import sys
3
+
4
+ class copyright(object):
5
+ def __init__(self):
6
+ self.message = """Copyright (c) 2026-2026 TheUltimateGenius4999.
7
+ I, TheUltimateGenius4999, DO NOT CONDONE OR IS LIABLE TO ANY DAMAGES
8
+ ASSOSCIATED WITH SHA1024. USE AT YOUR OWN RISK. SHA1024 CURRENTLY HAS
9
+ UNKNOWN PROPERTIES THAT HAVE A POSSIBILITY OF SECURITY DAMAGES, FRAUD,
10
+ OR ANY OTHER WAY OF THE POSSIBLE CLAIMS OF DAMAGES.
11
+
12
+ ANY VIOLATION OF THE GIVEN LICENSE IS CAUSE FOR THE COPYRIGHTED MATERIAL
13
+ TO BE TAKEN DOWN.
14
+
15
+ Licensed under the Apache 2.0 License."""
16
+
17
+ def __call__(self):
18
+ return self.message
19
+
20
+ def __repr__(self):
21
+ return str(self.message)
22
+
23
+ __doc__ = """
24
+ SHA1024 is a module that contains a SHA1024 algorithm developed
25
+ by [CENSORED] (TheUltimateGeinus4999 @PyPI, TickLice112 and CrazyDumpPants
26
+ @Youtube).
27
+
28
+ Algorithm:
29
+
30
+ def sha1024(data):
31
+ orig = len(data)
32
+ data += b"\x80"
33
+ while len(data) % 512 != 64:
34
+ data += b"\x00"
35
+ data += chr(orig%256).encode() + b"\x00" * 16
36
+ iv = [0x873d88a0d72b, 0xb59e8533ed62e, 0x1595cb39502df, 0xf4fa415e2720c, 0x10e721b6e7b332, 0x12526a3384306e, 0x139b019a0a7cbe, 0x14c79295ae9040, 0x22fb2a4a24042, 0x16dee3873804a2]
37
+ a = iv[0] ^ iv[1]
38
+ b = iv[1] ^ iv[2]
39
+ c = iv[2] ^ iv[3]
40
+ d = iv[3] ^ iv[4]
41
+ e = (~iv[4]) ^ iv[5]
42
+ f = iv[5] ^ iv[6]
43
+ g = iv[6] ^ iv[7]
44
+ h = iv[7] ^ iv[8]
45
+ j = (~iv[8]) ^ iv[9]
46
+ new = b""
47
+
48
+ for i in range(len(data) + 1):
49
+ i = i - 1
50
+ temp1 = (a ^ h ^ b ^ j ^ data[i]) & (2**32 - 1)
51
+ temp2 = (((temp1 << 3) * a) >> 3) & (2**32 - 1)
52
+ maj = (a & b) ^ (b & c) ^ (a & c) ^ (b & d) ^ (a & d) ^ (c & d)
53
+ a = (a ^ b + c) & (2**32 - 1)
54
+ b = (b + c - a) & (2**32 - 1)
55
+ c = (d ^ b ^ a ^ c ^ temp2 ^ data[i]) & (2**32 - 1)
56
+ d = (maj | (a ^ ~h) | d) & (2**32 - 1)
57
+ e = ((a + b + ~c + d + e + f + g) ^ (h + j + ~a + ~b)) >> 3
58
+ f = maj ^ a ^ f ^ iv[i%10] ^ iv[2] ^ temp1 ^ temp2
59
+ g = iv[i%10] | iv[(i+4)%10] | iv[(i+7)%10] | data[i]
60
+ h = g ^ b ^ a ^ h ^ e ^ f
61
+ j = a ^ e ^ f ^ (j & b) ^ (e & j)
62
+ a = b & data[i]
63
+ b = c
64
+ c = (maj + d - i * data[i]) & (2**32 - 1)
65
+ d = e ^ g
66
+ e = f
67
+ f = g ^ data[(i+2) % len(data)]
68
+ g = h ^ data[(i*3) % len(data)]
69
+ h = j
70
+ j = ((a >> 4) + i + (temp1 ^ temp2)) & 2**32 - 1
71
+ new += str(data[i] ^ ((a + b) ^ (c + d) ^ (e + f) ^ (g + h) ^ j) & (2**32 - 1)).encode()
72
+
73
+ new += hex(a + b + c + d + e + f + g + h + j)[2:].encode()
74
+ h = b""
75
+
76
+ for i in bytes(new):
77
+ i ^= (a + b + c) & (2**32 - 1)
78
+ i <<= 5
79
+ i *= 7
80
+ i ^= (i << 3)
81
+ i >>= 5
82
+ a ^= i
83
+ b ^= i
84
+ c ^= i ^ b ^ a
85
+ i &= 2 ** 32 - 1
86
+ h += i.to_bytes(4, byteorder='big')
87
+
88
+ return h.hex()[17:1024 // 4 + 17]
89
+
90
+ """
91
+
92
+ def _sha1024(data):
93
+ """SHA1024 hash. (Returns the digest)"""
94
+ data += b"\x80"
95
+ while (orig := len(data)-1) % 512 != 64:
96
+ data += b"\x00"
97
+ data += chr(orig%256).encode() + b"\x00" * 64
98
+ iv = [0x873d88a0d72b, 0xb59e8533ed62e, 0x1595cb39502df, 0xf4fa415e2720c, 0x10e721b6e7b332, 0x12526a3384306e, 0x139b019a0a7cbe, 0x14c79295ae9040, 0x22fb2a4a24042, 0x16dee3873804a2]
99
+ a = iv[0] ^ iv[1]
100
+ b = iv[1] ^ iv[2]
101
+ c = iv[2] ^ iv[3]
102
+ d = iv[3] ^ iv[4]
103
+ e = (~iv[4]) ^ iv[5]
104
+ f = iv[5] ^ iv[6]
105
+ g = iv[6] ^ iv[7]
106
+ h = iv[7] ^ iv[8]
107
+ j = (~iv[8]) ^ iv[9] # No i because of for loop
108
+ new = b""
109
+
110
+ for i in range(len(data) + 1):
111
+ i = i - 1
112
+ temp1 = (a ^ h ^ b ^ j ^ data[i]) & (2**32 - 1)
113
+ temp2 = (((temp1 << 3) * a) >> 3) & (2**32 - 1)
114
+ maj = (a & b) ^ (b & c) ^ (a & c) ^ (b & d) ^ (a & d) ^ (c & d)
115
+ a = (a ^ b + c) & (2**32 - 1)
116
+ b = (b + c - a) & (2**32 - 1)
117
+ c = (d ^ b ^ a ^ c ^ temp2 ^ data[i]) & (2**32 - 1)
118
+ d = (maj | (a ^ ~h) | d) & (2**32 - 1)
119
+ e = ((a + b + ~c + d + e + f + g) ^ (h + j + ~a + ~b)) >> 3
120
+ f = maj ^ a ^ f ^ iv[i%10] ^ iv[2] ^ temp1 ^ temp2
121
+ g = iv[i%10] | iv[(i+4)%10] | iv[(i+7)%10] | data[i]
122
+ h = g ^ b ^ a ^ h ^ e ^ f
123
+ j = a ^ e ^ f ^ (j & b) ^ (e & j)
124
+ a = b & data[i]
125
+ b = c
126
+ c = (maj + d - i * data[i]) & (2**32 - 1)
127
+ d = e ^ g
128
+ e = f
129
+ f = g ^ data[(i+2) % len(data)]
130
+ g = h ^ data[(i*3) % len(data)]
131
+ h = j
132
+ j = ((a >> 4) + i + (temp1 ^ temp2)) & 2**32 - 1
133
+ new += str(data[i] ^ ((a + b) ^ (c + d) ^ (e + f) ^ (g + h) ^ j) & (2**32 - 1)).encode()
134
+
135
+ new += hex(a + b + c + d + e + f + g + h + j)[2:].encode()
136
+ h = b""
137
+
138
+ for i in bytes(new):
139
+ i ^= (a + b + c) & (2**32 - 1)
140
+ i <<= 5
141
+ i *= 7
142
+ i ^= (i << 3)
143
+ i >>= 5
144
+ a ^= i
145
+ b ^= i
146
+ c ^= i ^ b ^ a
147
+ i &= 2 ** 32 - 1
148
+ h += i.to_bytes(4, byteorder='big')
149
+
150
+ return h
151
+
152
+ class AlreadyInitializedError(Exception):
153
+ pass
154
+
155
+ class _SHA1024():
156
+ """Wrapper for SHA1024.
157
+ CAUTION: Do not share any part of this publicly, or else someone could plan an attack."""
158
+ def __init__(self, data=b""):
159
+ self.obj = f"{id(self):016x}"
160
+ self.digest = _sha1024(data)
161
+ self._preimage = data
162
+ self._digested = False
163
+
164
+ def __repr__(self):
165
+ return str(f"<sha1024 sha1024._SHA1024 object @ 0x{self.obj}>")
166
+
167
+ def copy(self):
168
+ return _SHA1024(self._preimage)
169
+
170
+ def update(self, data):
171
+ if not self._digested:
172
+ self.digest = _sha1024(self._preimage + data)
173
+ self._preimage += data
174
+ else:
175
+ sys.tracebacklimit = 0
176
+ raise AlreadyInitializedError
177
+
178
+ def digest(self):
179
+ self._digested = True
180
+ return self.digest[17:273]
181
+
182
+ def hexdigest(self):
183
+ self._digested = True
184
+ return self.digest.hex()[17:273]
185
+
186
+ def sha1024(data=b""):
187
+ return _SHA1024(data)
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: sha_1024
3
+ Version: 1.0.0
4
+ Summary: A potential build for a 1024-bit SHA2 implementation.
5
+ Author: TheUltimateGenius4999
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://pypi.org/project/sha_1024
8
+ Keywords: cryptography,hash,sha_1024,kilobit,avalanch-entropy
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Security :: Cryptography
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.8
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Dynamic: license-file
@@ -0,0 +1,7 @@
1
+ sha_1024/__init__.py,sha256=8SLAkhRhBdMt4Vb2CPjb7np4KPPPlPAzscMM2ktolbQ,106
2
+ sha_1024/sha1024.py,sha256=8UNJ9ZtS6sHbSiWw0xEooKi8inqonwFUdyXbb1x4GJQ,6119
3
+ sha_1024-1.0.0.dist-info/licenses/LICENSE,sha256=4ghqkHxtTuYdY2-gTCEy_xibmyLJPo45uzlHKwkqFUg,572
4
+ sha_1024-1.0.0.dist-info/METADATA,sha256=Ya0AHftLvHMDLRsX75xnMmFO9fSyJrwIBkM7EizvJQ0,663
5
+ sha_1024-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
6
+ sha_1024-1.0.0.dist-info/top_level.txt,sha256=dFcBnMfwHXeJDO-nfAmhHHW2cjAYWKlmuu3YtIiK4o4,9
7
+ sha_1024-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,12 @@
1
+ Copyright (c) 2026-2026 TheUltimateGenius4999.
2
+
3
+ I, TheUltimateGenius4999, AM NOT LIABLE TO ANY DAMAGE ASSOCIATED WITH SHA1024.
4
+ USE AT YOUR OWN RISK. SHA1024 CURRENTLY HAS UNKNOWN PROPERTIES THAT HAVE A
5
+ POSSIBILITY OF SECURITY DAMAGES, FRAUD, OR ANY OTHER FORMS OF DAMAGES. ANY
6
+ CHANGES MADE ARE TO BE REGISTERED BY THE DISTRIBUTOR'S NAME INSTEAD OF THE
7
+ AUTHOR'S. THIS LICENSE STATEMENT IS TO BE RETAINED IN THE EVENT OF USAGE.
8
+
9
+ ANY VIOLATION OF THE GIVEN LICENSE IS CAUSE FOR THE COPYRIGHTED MATERIAL TO BE
10
+ TAKEN DOWN.
11
+
12
+ Licensed under the Apache 2.0 License.
@@ -0,0 +1 @@
1
+ sha_1024