From 71646bb590d903f475796424590521dc149b0117 Mon Sep 17 00:00:00 2001 From: Aahan Salecha Date: Sun, 9 Feb 2025 16:51:21 +0530 Subject: [PATCH] moved to source folder --- .github/SECURITY.md | 3 +- .gitignore | 6 +++- secrypto/__init__.py | 7 +++-- .../{cryptograph.py => source/decrypt.py} | 28 +------------------ secrypto/source/encrypt.py | 27 ++++++++++++++++++ secrypto/{ => source}/key.py | 0 setup.py | 16 +++++------ 7 files changed, 47 insertions(+), 40 deletions(-) rename secrypto/{cryptograph.py => source/decrypt.py} (58%) create mode 100644 secrypto/source/encrypt.py rename secrypto/{ => source}/key.py (100%) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 183de33..90900c4 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -6,10 +6,11 @@ There is no data used/processed except for your score, time and block, which is ## Supported Versions | Version | Supported | -| ------- | ------------------ | +|---------| ------------------ | | v1.0.0 | ❌ | | v1.0.1 | ❌ | | v1.0.2 | ✅ | +| v1.0.3 | ✅ | ## Reporting a Vulnerability Make a new issue for reporting a vulnerability, or make a pull request if you manage to fix it. \ No newline at end of file diff --git a/.gitignore b/.gitignore index fdf13d8..48058ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ __pycache__/ *.pyc -notes.txt \ No newline at end of file +notes.txt +secrypto.egg-info/ +dist/ +build/ +.idea/ \ No newline at end of file diff --git a/secrypto/__init__.py b/secrypto/__init__.py index bc7e93a..ecbab51 100644 --- a/secrypto/__init__.py +++ b/secrypto/__init__.py @@ -1,4 +1,5 @@ -from .key import Key -from .cryptograph import encrypt, decrypt +from .source.key import Key +from .source.encrypt import encrypt +from .source.decrypt import decrypt -version = "v1.0.0" \ No newline at end of file +version = "v1.0.3" \ No newline at end of file diff --git a/secrypto/cryptograph.py b/secrypto/source/decrypt.py similarity index 58% rename from secrypto/cryptograph.py rename to secrypto/source/decrypt.py index 0f45074..17bd28a 100644 --- a/secrypto/cryptograph.py +++ b/secrypto/source/decrypt.py @@ -1,30 +1,4 @@ -from .key import Key -from random import shuffle, choice as select - -def encrypt(string: str, key: Key | dict[str, list[str]]): - if not string: - return '' - - encryption = string - - str_order = ["a", "o", "b", "h"] - shuffle(str_order) - str_order = ''.join(str_order) - - for char in str_order: - if char == 'a': - encryption = ''.join(str(ord(a)) + select(['¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']) for a in encryption) - elif char == 'o': - encryption = ''.join(str(oct(ord(a))).replace('0o', '') + select(['9', 'A', 'B', 'C', 'D', 'E', 'F', 'G']) for a in encryption) - elif char == 'b': - encryption = ''.join(str(bin(ord(a))).replace('b', '') + select(['2', '3', '4', '5', '5', '6', '7', '8']) for a in encryption) - elif char == 'h': - encryption = ''.join(str(hex(ord(a))).replace('x', '') + select(['g', 'h', 'i', 'j', 'k', 'l', 'm', 'n']) for a in encryption) - - key = key.key if isinstance(key, Key) else key - encryption = ''.join(select(key[a]) for a in encryption + str_order[::-1]) - - return encryption +from secrypto.source.key import Key def decrypt(encryption: str, key: Key | dict[str, list[str]]): if not encryption: diff --git a/secrypto/source/encrypt.py b/secrypto/source/encrypt.py new file mode 100644 index 0000000..9eaa851 --- /dev/null +++ b/secrypto/source/encrypt.py @@ -0,0 +1,27 @@ +from secrypto.source.key import Key +from random import shuffle, choice as select + +def encrypt(string: str, key: Key | dict[str, list[str]]): + if not string: + return '' + + encryption = string + + str_order = ["a", "o", "b", "h"] + shuffle(str_order) + str_order = ''.join(str_order) + + for char in str_order: + if char == 'a': + encryption = ''.join(str(ord(a)) + select(['¹', '²', '³', '⁴', '⁵', '⁶', '⁷', '⁸', '⁹']) for a in encryption) + elif char == 'o': + encryption = ''.join(str(oct(ord(a))).replace('0o', '') + select(['9', 'A', 'B', 'C', 'D', 'E', 'F', 'G']) for a in encryption) + elif char == 'b': + encryption = ''.join(str(bin(ord(a))).replace('b', '') + select(['2', '3', '4', '5', '5', '6', '7', '8']) for a in encryption) + elif char == 'h': + encryption = ''.join(str(hex(ord(a))).replace('x', '') + select(['g', 'h', 'i', 'j', 'k', 'l', 'm', 'n']) for a in encryption) + + key = key.key if isinstance(key, Key) else key + encryption = ''.join(select(key[a]) for a in encryption + str_order[::-1]) + + return encryption \ No newline at end of file diff --git a/secrypto/key.py b/secrypto/source/key.py similarity index 100% rename from secrypto/key.py rename to secrypto/source/key.py diff --git a/setup.py b/setup.py index 8d9f4f5..6d2368b 100644 --- a/setup.py +++ b/setup.py @@ -3,14 +3,14 @@ long_description = """
-# **`Secrypto`** +# **Secrypto** **Secrypto** is an excellent cryptographer, with more than $4.5e806$ (**45 with 805 following zeros!**) possible combinations. ---

-# **`Contents`** +# **Contents**
* [**`How To Use`**](#how-to-use) @@ -22,7 +22,7 @@

-# **`How To Use`** +# **How To Use**
@@ -79,7 +79,7 @@

-# [**`License`**](https://creativecommons.org/publicdomain/zero/1.0/legalcode.en "CC0 1.0 Universal Website") +# [**License**](https://creativecommons.org/publicdomain/zero/1.0/legalcode.en "CC0 1.0 Universal Website")
@@ -88,7 +88,7 @@

-# [**`Contributing`**](https://github.com/aahan0511/Secrypto/blob/main/.github/CONTRIBUTING.md "Contributing on Secrypto") +# [**Contributing**](https://github.com/aahan0511/Secrypto/blob/main/.github/CONTRIBUTING.md "Contributing on Secrypto")
@@ -97,7 +97,7 @@

-# [**`Code Of Conduct`**](https://www.contributor-covenant.org/ "Contributor Covenant Website") +# [**Code Of Conduct**](https://www.contributor-covenant.org/ "Contributor Covenant Website")
@@ -106,7 +106,7 @@

-# [**`Security`**](https://github.com/aahan0511/Secrypto/blob/main/.github/SECURITY.md "Security on Secrypto") +# [**Security**](https://github.com/aahan0511/Secrypto/blob/main/.github/SECURITY.md "Security on Secrypto")
@@ -115,7 +115,7 @@ setup( name='secrypto', - version='1.0.2', + version='1.0.3', packages=find_packages(), install_requires=[], author='Aahan Salecha',