From 42b7f5de644e237b309eb0fcb8ab8e670a39ef88 Mon Sep 17 00:00:00 2001 From: Blue Fox Date: Sat, 14 Oct 2023 15:56:37 +0200 Subject: [PATCH] Initial commit --- .idea/.gitignore | 3 ++ .../inspectionProfiles/profiles_settings.xml | 6 ++++ .idea/misc.xml | 4 +++ .idea/modules.xml | 8 +++++ .idea/theoEnc.iml | 8 +++++ PACKAGE/__init__py | 0 PACKAGE/build/lib/theoEnc/E2EE.py | 32 ++++++++++++++++++ PACKAGE/build/lib/theoEnc/__init__.py | 0 PACKAGE/build/lib/theoEnc/compress.py | 14 ++++++++ PACKAGE/build/lib/theoEnc/otp.py | 15 ++++++++ PACKAGE/build/lib/theoEnc/random.py | 11 ++++++ PACKAGE/setup.py | 10 ++++++ PACKAGE/theoEnc/E2EE.py | 32 ++++++++++++++++++ PACKAGE/theoEnc/__init__.py | 0 .../theoEnc/__pycache__/E2EE.cpython-38.pyc | Bin 0 -> 1574 bytes .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 180 bytes .../__pycache__/compress.cpython-38.pyc | Bin 0 -> 596 bytes .../theoEnc/__pycache__/otp.cpython-38.pyc | Bin 0 -> 724 bytes .../theoEnc/__pycache__/random.cpython-38.pyc | Bin 0 -> 477 bytes PACKAGE/theoEnc/compress.py | 14 ++++++++ PACKAGE/theoEnc/otp.py | 15 ++++++++ PACKAGE/theoEnc/random.py | 11 ++++++ client.py | 12 +++++++ server.py | 14 ++++++++ test.py | 24 +++++++++++++ theoEnc/E2EE.py | 32 ++++++++++++++++++ theoEnc/__init__.py | 0 theoEnc/__pycache__/E2EE.cpython-310.pyc | Bin 0 -> 1656 bytes theoEnc/__pycache__/E2EE.cpython-38.pyc | Bin 0 -> 1574 bytes theoEnc/__pycache__/__init__.cpython-310.pyc | Bin 0 -> 154 bytes theoEnc/__pycache__/__init__.cpython-38.pyc | Bin 0 -> 180 bytes theoEnc/__pycache__/compress.cpython-310.pyc | Bin 0 -> 578 bytes theoEnc/__pycache__/compress.cpython-38.pyc | Bin 0 -> 596 bytes theoEnc/__pycache__/otp.cpython-310.pyc | Bin 0 -> 561 bytes theoEnc/__pycache__/otp.cpython-38.pyc | Bin 0 -> 724 bytes theoEnc/__pycache__/random.cpython-310.pyc | Bin 0 -> 453 bytes theoEnc/__pycache__/random.cpython-38.pyc | Bin 0 -> 477 bytes theoEnc/compress.py | 14 ++++++++ theoEnc/otp.py | 15 ++++++++ theoEnc/random.py | 11 ++++++ 40 files changed, 305 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/theoEnc.iml create mode 100755 PACKAGE/__init__py create mode 100755 PACKAGE/build/lib/theoEnc/E2EE.py create mode 100755 PACKAGE/build/lib/theoEnc/__init__.py create mode 100755 PACKAGE/build/lib/theoEnc/compress.py create mode 100755 PACKAGE/build/lib/theoEnc/otp.py create mode 100755 PACKAGE/build/lib/theoEnc/random.py create mode 100755 PACKAGE/setup.py create mode 100755 PACKAGE/theoEnc/E2EE.py create mode 100755 PACKAGE/theoEnc/__init__.py create mode 100755 PACKAGE/theoEnc/__pycache__/E2EE.cpython-38.pyc create mode 100755 PACKAGE/theoEnc/__pycache__/__init__.cpython-38.pyc create mode 100755 PACKAGE/theoEnc/__pycache__/compress.cpython-38.pyc create mode 100755 PACKAGE/theoEnc/__pycache__/otp.cpython-38.pyc create mode 100755 PACKAGE/theoEnc/__pycache__/random.cpython-38.pyc create mode 100755 PACKAGE/theoEnc/compress.py create mode 100755 PACKAGE/theoEnc/otp.py create mode 100755 PACKAGE/theoEnc/random.py create mode 100755 client.py create mode 100755 server.py create mode 100755 test.py create mode 100755 theoEnc/E2EE.py create mode 100755 theoEnc/__init__.py create mode 100644 theoEnc/__pycache__/E2EE.cpython-310.pyc create mode 100755 theoEnc/__pycache__/E2EE.cpython-38.pyc create mode 100644 theoEnc/__pycache__/__init__.cpython-310.pyc create mode 100755 theoEnc/__pycache__/__init__.cpython-38.pyc create mode 100644 theoEnc/__pycache__/compress.cpython-310.pyc create mode 100755 theoEnc/__pycache__/compress.cpython-38.pyc create mode 100644 theoEnc/__pycache__/otp.cpython-310.pyc create mode 100755 theoEnc/__pycache__/otp.cpython-38.pyc create mode 100644 theoEnc/__pycache__/random.cpython-310.pyc create mode 100755 theoEnc/__pycache__/random.cpython-38.pyc create mode 100755 theoEnc/compress.py create mode 100755 theoEnc/otp.py create mode 100755 theoEnc/random.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..dc9ea49 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e0e67ca --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/theoEnc.iml b/.idea/theoEnc.iml new file mode 100644 index 0000000..8437fe6 --- /dev/null +++ b/.idea/theoEnc.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PACKAGE/__init__py b/PACKAGE/__init__py new file mode 100755 index 0000000..e69de29 diff --git a/PACKAGE/build/lib/theoEnc/E2EE.py b/PACKAGE/build/lib/theoEnc/E2EE.py new file mode 100755 index 0000000..b70ebd0 --- /dev/null +++ b/PACKAGE/build/lib/theoEnc/E2EE.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +from .otp import encrypt_otp, decrypt_otp +from .compress import compress, decompress +from .random import random_string + +class E2EE: + def __init__(self, seed: str): + self.seed = seed + self.key = seed + + def get_key(self): + return self.key + + def add_compressed_key_part(self, ckeypart: bytes): + length = len(ckeypart) + ckeypart = decrypt_otp(ckeypart, self.key[length-1:]) + self.key = self.key[length-1:] # delete the used part of the full key + self.key += decompress(ckeypart) + + def generate_compressed_key_part(self, length: int, destroy_used_key=True): + ckeypart = random_string(length) + ckeypart = compress(ckeypart) + ckeypart_enc = encrypt_otp(ckeypart, self.key[len(ckeypart)-1:]) + if destroy_used_key: + self.key = self.key[len(ckeypart)-1:] # delete the of the full key which is used now + return ckeypart_enc + + def addCKeyPart(self, ckeypart: bytes): + self.add_compressed_key_part(ckeypart, length) + def generateCKeyPart(self, length: int, destroy_used_key=True): + self.generate_compressed_key_part(length, destroy_used_key) diff --git a/PACKAGE/build/lib/theoEnc/__init__.py b/PACKAGE/build/lib/theoEnc/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/PACKAGE/build/lib/theoEnc/compress.py b/PACKAGE/build/lib/theoEnc/compress.py new file mode 100755 index 0000000..8be18af --- /dev/null +++ b/PACKAGE/build/lib/theoEnc/compress.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import sys +import zlib +import secrets +import string + +def compress(to_compress: str): + ret = zlib.compress(bytes(to_compress, "ascii"), 9) + return ret + +def decompress(to_decompress: bytes): + ret = zlib.decompress(to_decompress) + return ret.decode("ascii") diff --git a/PACKAGE/build/lib/theoEnc/otp.py b/PACKAGE/build/lib/theoEnc/otp.py new file mode 100755 index 0000000..7c30fc6 --- /dev/null +++ b/PACKAGE/build/lib/theoEnc/otp.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +def encrypt_otp(message: bytes, key: str): + if len(message) > len(key): return False; + l = [] + for counter, i in enumerate(message): + l.append(i ^ key.encode()[counter]) + return bytes(l) + +def decrypt_otp(cipher: bytes, key: str): + if len(cipher) > len(key): return False; + l = [] + for counter, i in enumerate(cipher): + l.append(i ^ key.encode()[counter]) + return bytes(l) diff --git a/PACKAGE/build/lib/theoEnc/random.py b/PACKAGE/build/lib/theoEnc/random.py new file mode 100755 index 0000000..1896580 --- /dev/null +++ b/PACKAGE/build/lib/theoEnc/random.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +import secrets +import string + +def random_string(length: int): + symbols = string.punctuation + string.ascii_letters + string.digits + ret = "" + for _ in range(length): + ret += secrets.choice(symbols) + return ret diff --git a/PACKAGE/setup.py b/PACKAGE/setup.py new file mode 100755 index 0000000..03d5229 --- /dev/null +++ b/PACKAGE/setup.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +from __future__ import unicode_literals +from distutils.core import setup + +setup(name='theoEnc', + version='1.0', + description='Library for using the OTP (OneTimePad) in Python3', + author='Benjamin Burkhardt', + packages=['theoEnc']) diff --git a/PACKAGE/theoEnc/E2EE.py b/PACKAGE/theoEnc/E2EE.py new file mode 100755 index 0000000..b70ebd0 --- /dev/null +++ b/PACKAGE/theoEnc/E2EE.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +from .otp import encrypt_otp, decrypt_otp +from .compress import compress, decompress +from .random import random_string + +class E2EE: + def __init__(self, seed: str): + self.seed = seed + self.key = seed + + def get_key(self): + return self.key + + def add_compressed_key_part(self, ckeypart: bytes): + length = len(ckeypart) + ckeypart = decrypt_otp(ckeypart, self.key[length-1:]) + self.key = self.key[length-1:] # delete the used part of the full key + self.key += decompress(ckeypart) + + def generate_compressed_key_part(self, length: int, destroy_used_key=True): + ckeypart = random_string(length) + ckeypart = compress(ckeypart) + ckeypart_enc = encrypt_otp(ckeypart, self.key[len(ckeypart)-1:]) + if destroy_used_key: + self.key = self.key[len(ckeypart)-1:] # delete the of the full key which is used now + return ckeypart_enc + + def addCKeyPart(self, ckeypart: bytes): + self.add_compressed_key_part(ckeypart, length) + def generateCKeyPart(self, length: int, destroy_used_key=True): + self.generate_compressed_key_part(length, destroy_used_key) diff --git a/PACKAGE/theoEnc/__init__.py b/PACKAGE/theoEnc/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/PACKAGE/theoEnc/__pycache__/E2EE.cpython-38.pyc b/PACKAGE/theoEnc/__pycache__/E2EE.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..e2d6d8cb7cfba1aa0068a4e515ee9c3ca4221800 GIT binary patch literal 1574 zcmZ`(&2AGh5cYUC$u>W23N0-H4jgkK5<=pFDyk9{QK_m_RYH5f+QcSJo81jw_mFCP zN_mSO=n3VO_R5JzfD<#`Y)Jncc|7BBJl}jX>!U`a%5Z%8`8oLGF!qa##esY5J5|FPg!>g)K4h)RZ@^1hJgcdw zr^h2BVl&EWQq2wYdA&FsX_X{d6&*9Z1zAG}k&Hu;7(IykJ-q0~nB)9{+lu)hna`CY z;R+;|&L!f@@%SZGR*2_{%Zl`H-$QE&PgP|Nt);oQE*of9XWnJGf>up7F^|>E?Y!=E z5R{uJC3}1U3F$O)2GKl`$OD23sq#2_Q$x}9jK&zpyR#{!Vsw-{Y0G_)i%c}?nJ%z!S>GH_HJix z6WCXyapnmzhz3Roik`SA7?k0>Vf}@#M>Q%2=`?LNWmHmjf;s3VR9m2_b#STSVu9zP zfo4|eDWzKSf)B;VwG?L23` zEmso|P4s9YH?M?~XGVebDhVQgp(fA!DpEQy>b~^W@N8n=0`Txxrxah#3ij~7ZX`%Z z<`pAq4f}!JpTf0$D~i71IZO(8Zvkq^>CT=SA0X+^2-U28ng!v7^G>VI*=VyIa#RD^i35P$s!8^wwJR-HbqCq2}x3x+d~gAbP` zT$&mwD|N?4C7CmbjJ8ZzOdI6iB=H}Z)##hj6%;fR+VWu8^_*sDxzgm;v)}T32OreD kA&82+Kd90Da{hYeZ9{k57a;TA<>0sI-?rDA(1bew2g4shZ2$lO literal 0 HcmV?d00001 diff --git a/PACKAGE/theoEnc/__pycache__/__init__.cpython-38.pyc b/PACKAGE/theoEnc/__pycache__/__init__.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..8edde65546e87b6df9afe46cd8186e98f7a89bb2 GIT binary patch literal 180 zcmWIL<>g`kf(eTv5<&E15P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;x_yenx(7s(w;x zQfX0kMxwq;esXDUYFlIYq;;_lhPbtkwwF6oC8HgDGGL|k8 literal 0 HcmV?d00001 diff --git a/PACKAGE/theoEnc/__pycache__/compress.cpython-38.pyc b/PACKAGE/theoEnc/__pycache__/compress.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..39e85ead4134e11dcc2505b40e372b88502c0549 GIT binary patch literal 596 zcmZWny-ve05VoCP`hySy?~sMO076uy0tu&TBC>Iz5*~Q3;(6lpLzOuB+(~^E)v%A~ho+d($!B6R-KVYsdfT9vi*@Ti#n|o???Hl!QSU}8>nm&kEw~xm_#=W+6G{qa zI&rIj-&D0Ap#R>bMO`I{t)~~-F=de!B`ii~p*9M{!YiZPl~uH+*rLVlDde{CQ7!p= QB98I@&{&G8d)Ti31NWPMY5)KL literal 0 HcmV?d00001 diff --git a/PACKAGE/theoEnc/__pycache__/otp.cpython-38.pyc b/PACKAGE/theoEnc/__pycache__/otp.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..2c4d25cd2121daf7c5f0c117f79cea378c33b0df GIT binary patch literal 724 zcmaKq%Zd|06o%{4ml=zI*%*6pE42*(^BHdkwq)qzbsmdbIS;fbg zMY0im7T=(@zJ)8#>0x9>&}!=M`cHLLpYv6{9S-jaYKPz6Wj~}4KiS-Fn#>F8_J{=N zG2%)YY1G%?y#z&GlMhTtUYqDrBypmAT!FRO6uh3ps!+7_riCTxfAj6@dvfm>!4Fx-36WGc&8tUvDir|z8pE4+0eQ~P0o_g z>jl()AL?ZVm^ttf)J0?HowY60#)tXJflWfBf(3GRUM_rGG|SondRcxKIH2gSH|eaY zAk86P;(V5+Crv?n*3PEqO`exv(+g~-m{nC-PkH)lGc!%W75>b}SVIgE`UssNGeFR;%e*dG1A{d+{)#-o zh&*)G-in&qYp{YhI3{cQxVNJC3%$0aSGR#SN|agDTvTOhs@MowM(tRqLQHaQ3|Be| zn8<|Dwx;4TAOsyOl>ol24Np06nCi0XP-Br@05!>)zN2T^V@KR4l27CcONQmOeg z4o5Pr3SJr=Udkj9T!&*NGZhyF3UT?2&kYX``?uqMI35hI1{ddl3rs)aR_=32@v&3d9Vo9af^Ki72K#z`SrmGe_~F6|yPph15Dt8#NI literal 0 HcmV?d00001 diff --git a/PACKAGE/theoEnc/compress.py b/PACKAGE/theoEnc/compress.py new file mode 100755 index 0000000..8be18af --- /dev/null +++ b/PACKAGE/theoEnc/compress.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import sys +import zlib +import secrets +import string + +def compress(to_compress: str): + ret = zlib.compress(bytes(to_compress, "ascii"), 9) + return ret + +def decompress(to_decompress: bytes): + ret = zlib.decompress(to_decompress) + return ret.decode("ascii") diff --git a/PACKAGE/theoEnc/otp.py b/PACKAGE/theoEnc/otp.py new file mode 100755 index 0000000..7c30fc6 --- /dev/null +++ b/PACKAGE/theoEnc/otp.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +def encrypt_otp(message: bytes, key: str): + if len(message) > len(key): return False; + l = [] + for counter, i in enumerate(message): + l.append(i ^ key.encode()[counter]) + return bytes(l) + +def decrypt_otp(cipher: bytes, key: str): + if len(cipher) > len(key): return False; + l = [] + for counter, i in enumerate(cipher): + l.append(i ^ key.encode()[counter]) + return bytes(l) diff --git a/PACKAGE/theoEnc/random.py b/PACKAGE/theoEnc/random.py new file mode 100755 index 0000000..1896580 --- /dev/null +++ b/PACKAGE/theoEnc/random.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +import secrets +import string + +def random_string(length: int): + symbols = string.punctuation + string.ascii_letters + string.digits + ret = "" + for _ in range(length): + ret += secrets.choice(symbols) + return ret diff --git a/client.py b/client.py new file mode 100755 index 0000000..e2e29ac --- /dev/null +++ b/client.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 + +from theoEnc.E2EE import E2EE + +seed = input("Seed: ") + +e2ee = E2EE(seed) + +while True: + ckeypart = input("Neuer Schlüsselteil: ").encode() + e2ee.add_compressed_key_part(ckeypart, 10) + print("\nKey: " + e2ee.get_key()) diff --git a/server.py b/server.py new file mode 100755 index 0000000..8d7457c --- /dev/null +++ b/server.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +from theoEnc.E2EE import E2EE +from theoEnc.random import random_string + +seed = random_string(20) +print("Seed: " + seed) + +e2ee = E2EE(seed) + +while True: + input("Neuer Schlüsselteil: [ENTER] ") + ckeypart = e2ee.generate_compressed_key_part(10) + print("\nKey: " + e2ee.get_key() + "\nNeuer kompressierter Schlüsselteil: " + ckeypart.decode()) diff --git a/test.py b/test.py new file mode 100755 index 0000000..52b2d46 --- /dev/null +++ b/test.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 + +from theoEnc.E2EE import E2EE +from theoEnc.random import random_string + +LEN = 499900 + + +seed = random_string(500000) +print("[SERVER] Length of Seed: " + str(len(seed))) + +e2ee_server = E2EE(seed) +e2ee_client = E2EE(seed) + +print("\n[SERVER] Generating new compressed key part (CKP)...") +ckp = e2ee_server.generate_compressed_key_part(LEN, destroy_used_key=False) +e2ee_server.add_compressed_key_part(ckp) +print("[SERVER] Generated.") +print("[SERVER] Length of Key: " + str(len(e2ee_server.get_key()))) + +print("[CLIENT] Adding CCP...") +e2ee_client.add_compressed_key_part(ckp) +print("[CLIENT] Added.") +print("[CLIENT] Length of Key: " + str(len(e2ee_client.get_key()))) diff --git a/theoEnc/E2EE.py b/theoEnc/E2EE.py new file mode 100755 index 0000000..b70ebd0 --- /dev/null +++ b/theoEnc/E2EE.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 + +from .otp import encrypt_otp, decrypt_otp +from .compress import compress, decompress +from .random import random_string + +class E2EE: + def __init__(self, seed: str): + self.seed = seed + self.key = seed + + def get_key(self): + return self.key + + def add_compressed_key_part(self, ckeypart: bytes): + length = len(ckeypart) + ckeypart = decrypt_otp(ckeypart, self.key[length-1:]) + self.key = self.key[length-1:] # delete the used part of the full key + self.key += decompress(ckeypart) + + def generate_compressed_key_part(self, length: int, destroy_used_key=True): + ckeypart = random_string(length) + ckeypart = compress(ckeypart) + ckeypart_enc = encrypt_otp(ckeypart, self.key[len(ckeypart)-1:]) + if destroy_used_key: + self.key = self.key[len(ckeypart)-1:] # delete the of the full key which is used now + return ckeypart_enc + + def addCKeyPart(self, ckeypart: bytes): + self.add_compressed_key_part(ckeypart, length) + def generateCKeyPart(self, length: int, destroy_used_key=True): + self.generate_compressed_key_part(length, destroy_used_key) diff --git a/theoEnc/__init__.py b/theoEnc/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/theoEnc/__pycache__/E2EE.cpython-310.pyc b/theoEnc/__pycache__/E2EE.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..00e36c43ad9d3b3ac6e93fa69e679c9f9e1ba8aa GIT binary patch literal 1656 zcmZ`(%Wl*#6!jyMN$1t{MO##akl19yNNf-is*p;B1gNUiE>IR&)3NDmk_?V#F{5nLwX2*(qok{7G){-4N$Fa{n=iX%Pc7s6s_Tyvk(j(+2E^amsi`UTe zO&BDRbU+ds(}cy0;+hS3!egFzvFFx&P)q#Sr{pb>o~&IESvzNOUHW?@s{f*JNW^SY zrF}gf8j+cyZAx{$04(Td$xy32w+#TM^N8BE?xiwIL~itPdf119W*TrWd47V4A~BUD zW|AuYnMo%31@J5R#5L(FAKunw0B`GZQ8rWn>!xg7)Z)1*+Lj$a8`tQ(3;}J*1&CwG zdfU&px2=~eCHw3K51eD)f}V#k6tp0s9D&guxuQD}(*YospQ50iqN08c#!(}-$J4tO--;mDOk8A7C*Jn?u+f!smt+9Kz?u!}W{=UcvO!yD*S~ z7arKP00%}jjRtD8U85mo=!+%fEJRi|lnRO{8;en1MyQ=4t;#Kd)rqd&Fni-rrAqgV zx=WlD*qh@A0S)K|^*|zzPM%D2;r{Pt(gF!1bC(vbbjWu|3_~y7kETjVrk7!plNSof z1%;b$^KF7LTkq9)7rc7}_-{Nuq?536tpaB}Lci|dP_S7JRIkFuDxFYMjS}4E5LTL1 zcRj{U>o81KX0)mBorvy7EiB@+mnb1@Lx?1kqXEuaLVOwZ22+HCgSvy~VP@Le!PuzW zNn`nOY8*kmhWJAq{<-O9Siias1NIz`2}p+qUWbQ%Cs<|<+ld0p;Rju&k}D;bS(wDu dFaO46!r>`*U15V)CH+k-N>@H13u%ikvcG*&RB8YK literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/E2EE.cpython-38.pyc b/theoEnc/__pycache__/E2EE.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..e2d6d8cb7cfba1aa0068a4e515ee9c3ca4221800 GIT binary patch literal 1574 zcmZ`(&2AGh5cYUC$u>W23N0-H4jgkK5<=pFDyk9{QK_m_RYH5f+QcSJo81jw_mFCP zN_mSO=n3VO_R5JzfD<#`Y)Jncc|7BBJl}jX>!U`a%5Z%8`8oLGF!qa##esY5J5|FPg!>g)K4h)RZ@^1hJgcdw zr^h2BVl&EWQq2wYdA&FsX_X{d6&*9Z1zAG}k&Hu;7(IykJ-q0~nB)9{+lu)hna`CY z;R+;|&L!f@@%SZGR*2_{%Zl`H-$QE&PgP|Nt);oQE*of9XWnJGf>up7F^|>E?Y!=E z5R{uJC3}1U3F$O)2GKl`$OD23sq#2_Q$x}9jK&zpyR#{!Vsw-{Y0G_)i%c}?nJ%z!S>GH_HJix z6WCXyapnmzhz3Roik`SA7?k0>Vf}@#M>Q%2=`?LNWmHmjf;s3VR9m2_b#STSVu9zP zfo4|eDWzKSf)B;VwG?L23` zEmso|P4s9YH?M?~XGVebDhVQgp(fA!DpEQy>b~^W@N8n=0`Txxrxah#3ij~7ZX`%Z z<`pAq4f}!JpTf0$D~i71IZO(8Zvkq^>CT=SA0X+^2-U28ng!v7^G>VI*=VyIa#RD^i35P$s!8^wwJR-HbqCq2}x3x+d~gAbP` zT$&mwD|N?4C7CmbjJ8ZzOdI6iB=H}Z)##hj6%;fR+VWu8^_*sDxzgm;v)}T32OreD kA&82+Kd90Da{hYeZ9{k57a;TA<>0sI-?rDA(1bew2g4shZ2$lO literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/__init__.cpython-310.pyc b/theoEnc/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a15d68afcfd1a67c5240047a6bf5a12defe2cf05 GIT binary patch literal 154 zcmd1j<>g`kf(eTv5<&E15P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;!Hmenx(7s(w;x zQfX0kMxwq;esXDUYFpG-2eap literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/__init__.cpython-38.pyc b/theoEnc/__pycache__/__init__.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..8edde65546e87b6df9afe46cd8186e98f7a89bb2 GIT binary patch literal 180 zcmWIL<>g`kf(eTv5<&E15P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;x_yenx(7s(w;x zQfX0kMxwq;esXDUYFlIYq;;_lhPbtkwwF6oC8HgDGGL|k8 literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/compress.cpython-310.pyc b/theoEnc/__pycache__/compress.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7327e1454829136a7c5d42203b5baa31955a9159 GIT binary patch literal 578 zcmZWmJ5B>J5cOw&YzRd_++iE`0)UW!HbSC7+o0^)kR{nTvYjF*RB(`N$qhJ*TdG`v ziWx^6A~Dwd?9m&)8P)Hn1f>0X7#&kWzA@Ps4#^d$K_iHuQ&Ma_EvU~~!Mx`M7fc3E zOmGo=1Vt!989^3_7_wNUwhkMHzR&>$EOi(t*0LTv}-|rV-I`E$t`KSo?F4k5wb{QkDxn z8ISTCRV^AhvnIdO>P1eh%w+flLpcGU#DJPgeWS>$rp1gT+~C#CFMfqr_q=FL6-@yCf{3c#ha0_yx$( BdVv4{ literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/compress.cpython-38.pyc b/theoEnc/__pycache__/compress.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..39e85ead4134e11dcc2505b40e372b88502c0549 GIT binary patch literal 596 zcmZWny-ve05VoCP`hySy?~sMO076uy0tu&TBC>Iz5*~Q3;(6lpLzOuB+(~^E)v%A~ho+d($!B6R-KVYsdfT9vi*@Ti#n|o???Hl!QSU}8>nm&kEw~xm_#=W+6G{qa zI&rIj-&D0Ap#R>bMO`I{t)~~-F=de!B`ii~p*9M{!YiZPl~uH+*rLVlDde{CQ7!p= QB98I@&{&G8d)Ti31NWPMY5)KL literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/otp.cpython-310.pyc b/theoEnc/__pycache__/otp.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..110ac166115f91c1f86e1d2b075d29b009a7c5d4 GIT binary patch literal 561 zcmZ`#!EVz)5S`hzozM^(N>#OgKrZ+S5<(yf;#48^QX#6!@eWN%;&sQHLnP-EKBPV7 z%7KsBE1%FCr_KZs^}OQmys@{?+9P-ew}@~(2=ZnnJ8N_Dah*mxr7Aw6YCa<_ z0>!MTYpPt#s4Bgqn2r{KnqkWFyTGa};xu+jKd%CD#H%&%6Pf;bnUDR9@)3>ZJQ)}H zu`h+Q3Qhi*{dbxK%EOrahpOB@eW+j5i`bJ>yr{#4^j4_u)Z=|jaDa!{MIPwUth}nn z#Q*h%b(7V9R?9^2p4KXudkT*g`U)!dFYHPcdycl}^)f$IcqVW%6o2&-+XUXo*o+?# YY^XLY-Pbek=2Lp3J~gUi&m45_0VnQwzyJUM literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/otp.cpython-38.pyc b/theoEnc/__pycache__/otp.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..2c4d25cd2121daf7c5f0c117f79cea378c33b0df GIT binary patch literal 724 zcmaKq%Zd|06o%{4ml=zI*%*6pE42*(^BHdkwq)qzbsmdbIS;fbg zMY0im7T=(@zJ)8#>0x9>&}!=M`cHLLpYv6{9S-jaYKPz6Wj~}4KiS-Fn#>F8_J{=N zG2%)YY1G%?y#z&GlMhTtUYqDrBypmAT!FRO6uh3ps!+7_riCTxfAj6@dvfm>!4Fx-36WGc&8tUvDir|z8pE4+0eQ~P0o_g z>jl()AL?ZVm^ttf)J0?HowY60#)tXJflWfBf(3GRUM_rGG|SondRcxKIH2gSH|eaY zAk86P;(V5+Crv?n*3PEqO`exv(+g~-m{nC-PkH}vcUjCNR+igVnLNqmD(n8o7ly6hDzxKKLkd0egMD2 zD+A&$FmY}X>PhcCzdOr!K9wYU2;$@YF8c!g^kz2#FqZ&x1jG=-C7Ns%PcS2#JP;PJ z@Hw0W4Bw(*^bPmW*u^E6xh*L6_Af%v2yg{3CqNd>F@OyGDHxzNW_V3(*q|poLie3@ z&=4EF#0`GMr)W(cyA6RJWbDweAylFrmExR$|c+5bUSA3Kkawj$00tzJz(7f3nO$uv|o-3gtVLN aru`0eeYJgFDOQ*K!Y|eM2iv5L`{Wn<5N^Hz literal 0 HcmV?d00001 diff --git a/theoEnc/__pycache__/random.cpython-38.pyc b/theoEnc/__pycache__/random.cpython-38.pyc new file mode 100755 index 0000000000000000000000000000000000000000..8be75a64f1592018044b1091937f4ded8f153862 GIT binary patch literal 477 zcmYjOu}T9$5Z&3kT!KkJ(xkJnOXI~x8xcby3W5YwkOK*Kx65UdyW6)lGc!%W75>b}SVIgE`UssNGeFR;%e*dG1A{d+{)#-o zh&*)G-in&qYp{YhI3{cQxVNJC3%$0aSGR#SN|agDTvTOhs@MowM(tRqLQHaQ3|Be| zn8<|Dwx;4TAOsyOl>ol24Np06nCi0XP-Br@05!>)zN2T^V@KR4l27CcONQmOeg z4o5Pr3SJr=Udkj9T!&*NGZhyF3UT?2&kYX``?uqMI35hI1{ddl3rs)aR_=32@v&3d9Vo9af^Ki72K#z`SrmGe_~F6|yPph15Dt8#NI literal 0 HcmV?d00001 diff --git a/theoEnc/compress.py b/theoEnc/compress.py new file mode 100755 index 0000000..8be18af --- /dev/null +++ b/theoEnc/compress.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import sys +import zlib +import secrets +import string + +def compress(to_compress: str): + ret = zlib.compress(bytes(to_compress, "ascii"), 9) + return ret + +def decompress(to_decompress: bytes): + ret = zlib.decompress(to_decompress) + return ret.decode("ascii") diff --git a/theoEnc/otp.py b/theoEnc/otp.py new file mode 100755 index 0000000..7c30fc6 --- /dev/null +++ b/theoEnc/otp.py @@ -0,0 +1,15 @@ +#!/usr/bin/python3 + +def encrypt_otp(message: bytes, key: str): + if len(message) > len(key): return False; + l = [] + for counter, i in enumerate(message): + l.append(i ^ key.encode()[counter]) + return bytes(l) + +def decrypt_otp(cipher: bytes, key: str): + if len(cipher) > len(key): return False; + l = [] + for counter, i in enumerate(cipher): + l.append(i ^ key.encode()[counter]) + return bytes(l) diff --git a/theoEnc/random.py b/theoEnc/random.py new file mode 100755 index 0000000..1896580 --- /dev/null +++ b/theoEnc/random.py @@ -0,0 +1,11 @@ +#!/usr/bin/python3 + +import secrets +import string + +def random_string(length: int): + symbols = string.punctuation + string.ascii_letters + string.digits + ret = "" + for _ in range(length): + ret += secrets.choice(symbols) + return ret