XorCode 0.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.
- xorcode-0.1.0/PKG-INFO +9 -0
- xorcode-0.1.0/XorCode/XorCode.py +51 -0
- xorcode-0.1.0/XorCode/__init__.py +1 -0
- xorcode-0.1.0/XorCode.egg-info/PKG-INFO +9 -0
- xorcode-0.1.0/XorCode.egg-info/SOURCES.txt +8 -0
- xorcode-0.1.0/XorCode.egg-info/dependency_links.txt +1 -0
- xorcode-0.1.0/XorCode.egg-info/requires.txt +2 -0
- xorcode-0.1.0/XorCode.egg-info/top_level.txt +1 -0
- xorcode-0.1.0/pyproject.toml +16 -0
- xorcode-0.1.0/setup.cfg +4 -0
xorcode-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: XorCode
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: a encryption and decryption that use XOR operation
|
|
5
|
+
Author-email: sloan rizzlerr <sloanngutierrez@gmail.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: msgpack
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import msgpack
|
|
2
|
+
import secrets
|
|
3
|
+
import numpy as np
|
|
4
|
+
import zlib
|
|
5
|
+
|
|
6
|
+
class XorCODE:
|
|
7
|
+
def ToNP(Input):
|
|
8
|
+
raw = msgpack.packb(Input)
|
|
9
|
+
NP = np.frombuffer(raw, dtype=np.uint8).copy()
|
|
10
|
+
return NP
|
|
11
|
+
def GenerateKeyFromSeed(seed:int,Length:int):
|
|
12
|
+
rng = np.random.default_rng(seed)
|
|
13
|
+
return rng.integers(0, 256, size=Length, dtype=np.uint8)
|
|
14
|
+
def GenerateKeyAsNarray(Length:int):
|
|
15
|
+
random_bytes=secrets.token_bytes(len(Length))
|
|
16
|
+
Key = np.frombuffer(random_bytes, dtype=np.uint8).copy()
|
|
17
|
+
return Key
|
|
18
|
+
def EncodeWithSeed(seed:int,Input):
|
|
19
|
+
Einput = Input.copy()
|
|
20
|
+
Key=XorCODE.GenerateKeyFromSeed(seed,len(Einput))
|
|
21
|
+
output=Einput^Key
|
|
22
|
+
return output.copy()
|
|
23
|
+
def DecodeWithSeed(seed:int,Input):
|
|
24
|
+
Einput = Input.copy()
|
|
25
|
+
Key=XorCODE.GenerateKeyFromSeed(seed,len(Einput))
|
|
26
|
+
output=Einput^Key
|
|
27
|
+
return msgpack.unpackb(output.tobytes())
|
|
28
|
+
def EncodeWithNarray(Input):
|
|
29
|
+
Einput=Input.copy()
|
|
30
|
+
Key=XorCODE.GenerateKeyAsNarray(Einput)
|
|
31
|
+
output=Einput^Key
|
|
32
|
+
return output.copy(),Key
|
|
33
|
+
def DecodeWithNarray(Input,Key):
|
|
34
|
+
Einput=Input.copy()
|
|
35
|
+
output=Einput^Key
|
|
36
|
+
return msgpack.unpackb(output.tobytes())
|
|
37
|
+
def ToNPZlib(Input):
|
|
38
|
+
raw = msgpack.packb(Input)
|
|
39
|
+
compressed_raw = zlib.compress(raw, level=6)
|
|
40
|
+
return np.frombuffer(compressed_raw, dtype=np.uint8).copy()
|
|
41
|
+
def DecodeWithSeedZlib(seed:int,Input):
|
|
42
|
+
Einput=Input.copy()
|
|
43
|
+
Key=XorCODE.GenerateKeyFromSeed(seed,len(Einput))
|
|
44
|
+
output = Einput^Key
|
|
45
|
+
Eoutput = zlib.decompress(output)
|
|
46
|
+
return msgpack.unpackb(Eoutput)
|
|
47
|
+
def DecodeWithNarrayZlib(Input,key):
|
|
48
|
+
Einput=Input.copy()
|
|
49
|
+
output=Einput^key
|
|
50
|
+
Eoutput = zlib.decompress(output)
|
|
51
|
+
return msgpack.unpackb(Eoutput)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from XorCode import XorCODE
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: XorCode
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: a encryption and decryption that use XOR operation
|
|
5
|
+
Author-email: sloan rizzlerr <sloanngutierrez@gmail.com>
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Requires-Dist: msgpack
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
XorCode
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "XorCode"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="sloan rizzlerr", email="sloanngutierrez@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "a encryption and decryption that use XOR operation"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.8"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"numpy","msgpack"
|
|
16
|
+
]
|
xorcode-0.1.0/setup.cfg
ADDED