-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
47 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
__pycache__/ | ||
*.pyc | ||
notes.txt | ||
notes.txt | ||
secrypto.egg-info/ | ||
dist/ | ||
build/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
version = "v1.0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters