lemonade-cryptography 1.0.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.
@@ -0,0 +1,19 @@
1
+ MIT License
2
+
3
+ Copyright 2026 Vlinho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the “Software”), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: lemonade-cryptography
3
+ Version: 1.0.0
4
+ Summary: Lightweight byte-oriented encryption library.
5
+ Author: Vlinho
6
+ License: MIT License
7
+
8
+ Copyright 2026 Vlinho
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the “Software”), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ Keywords: cryptography,encryption,experimental
26
+ Classifier: Programming Language :: Python :: 3
27
+ Classifier: Operating System :: OS Independent
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Dynamic: license-file
32
+
33
+ # 🍋 Lemonade Cryptography
34
+
35
+ **Lemonade Cryptography** is a lightweight byte-oriented encryption library based on modular arithmetic and symmetric key transformations.
36
+
37
+ Lemonade transforms readable messages into encrypted data by converting text into bytes and applying mathematical operations using a cryptographic key.
38
+
39
+ The core concept is:
40
+
41
+ > Each byte of the message is encrypted by subtracting it from a corresponding byte of a secret key.
42
+
43
+ The original message can be recovered by applying the reverse operation using the same key.
44
+
45
+ ---
46
+
47
+ # Installation
48
+
49
+ Install Lemonade Cryptography using pip:
50
+
51
+ ```bash
52
+ pip install lemonade-cryptography
53
+ ```
54
+
55
+ ---
56
+
57
+ # Quick Start
58
+
59
+ ```python
60
+ from lemonade import encrypt, decrypt
61
+
62
+ message = "Hello. We are looking for highly intelligent individuals."
63
+
64
+ crypt, key = encrypt(message)
65
+
66
+ print("Encrypted:")
67
+ print(crypt)
68
+
69
+ print("\nKey:")
70
+ print(key)
71
+
72
+ original = decrypt(crypt, key)
73
+
74
+ print("\nDecrypted:")
75
+ print(original)
76
+ ```
77
+
78
+ Output:
79
+
80
+ ```
81
+ Encrypted:
82
+ <encrypted data>
83
+
84
+ Key:
85
+ <secret key>
86
+
87
+ Decrypted:
88
+ Hello. We are looking for highly intelligent individuals.
89
+ ```
90
+
91
+ ---
92
+
93
+ # Features
94
+
95
+ - Symmetric key encryption
96
+ - Byte-oriented processing
97
+ - UTF-8 message support
98
+ - Random cryptographic key generation
99
+ - Base64 encoded output
100
+ - Simple Python API
101
+ - Lightweight implementation
102
+
103
+ ---
104
+
105
+ # API Reference
106
+
107
+ ## `encrypt()`
108
+
109
+ ```python
110
+ encrypt(msg: str) -> tuple[str, str]
111
+ ```
112
+
113
+ Encrypts a message and generates a random key.
114
+
115
+ ### Arguments
116
+
117
+ | Argument | Type | Description |
118
+ |-|-|-|
119
+ | `msg` | `str` | Message to encrypt |
120
+
121
+ ### Returns
122
+
123
+ A tuple containing:
124
+
125
+ ```python
126
+ (
127
+ encrypted_message,
128
+ encryption_key
129
+ )
130
+ ```
131
+
132
+ Both values are encoded using Base64.
133
+
134
+ Example:
135
+
136
+ ```python
137
+ crypt, key = encrypt("Hello")
138
+ ```
139
+
140
+ ---
141
+
142
+ ## `decrypt()`
143
+
144
+ ```python
145
+ decrypt(crypt: str, key: str) -> str
146
+ ```
147
+
148
+ Decrypts a Lemonade encrypted message using its key.
149
+
150
+ ### Arguments
151
+
152
+ | Argument | Type | Description |
153
+ |-|-|-|
154
+ | `crypt` | `str` | Encrypted message in Base64 |
155
+ | `key` | `str` | Encryption key in Base64 |
156
+
157
+ ### Returns
158
+
159
+ The original message:
160
+
161
+ ```python
162
+ str
163
+ ```
164
+
165
+ Example:
166
+
167
+ ```python
168
+ message = decrypt(crypt, key)
169
+ ```
170
+
171
+ ---
172
+
173
+ # How It Works
174
+
175
+ Lemonade operates directly on byte values.
176
+
177
+ Example:
178
+
179
+ ```
180
+ A = 65
181
+ B = 66
182
+ C = 67
183
+ ```
184
+
185
+ The encryption operation is:
186
+
187
+ ```
188
+ C = (M - K) mod 256
189
+ ```
190
+
191
+ Where:
192
+
193
+ | Symbol | Meaning |
194
+ |-|-|
195
+ | `C` | Encrypted byte |
196
+ | `M` | Original message byte |
197
+ | `K` | Key byte |
198
+
199
+ The decryption operation reverses the transformation:
200
+
201
+ ```
202
+ M = (C + K) mod 256
203
+ ```
204
+
205
+ More technical details can be found in:
206
+
207
+ ```
208
+ docs/algorithm.md
209
+ ```
210
+
211
+ ---
212
+
213
+ # Security Notice
214
+
215
+ Lemonade Cryptography is an experimental encryption library created for educational purposes and lightweight applications.
216
+
217
+ It is not intended to replace modern cryptographic standards such as AES or ChaCha20 in security-critical systems.
218
+
219
+ Always protect your encryption keys. Without the correct key, encrypted messages cannot be recovered.
220
+
221
+ ---
222
+
223
+ # License
224
+
225
+ Lemonade Cryptography is licensed under the MIT License.
@@ -0,0 +1,193 @@
1
+ # 🍋 Lemonade Cryptography
2
+
3
+ **Lemonade Cryptography** is a lightweight byte-oriented encryption library based on modular arithmetic and symmetric key transformations.
4
+
5
+ Lemonade transforms readable messages into encrypted data by converting text into bytes and applying mathematical operations using a cryptographic key.
6
+
7
+ The core concept is:
8
+
9
+ > Each byte of the message is encrypted by subtracting it from a corresponding byte of a secret key.
10
+
11
+ The original message can be recovered by applying the reverse operation using the same key.
12
+
13
+ ---
14
+
15
+ # Installation
16
+
17
+ Install Lemonade Cryptography using pip:
18
+
19
+ ```bash
20
+ pip install lemonade-cryptography
21
+ ```
22
+
23
+ ---
24
+
25
+ # Quick Start
26
+
27
+ ```python
28
+ from lemonade import encrypt, decrypt
29
+
30
+ message = "Hello. We are looking for highly intelligent individuals."
31
+
32
+ crypt, key = encrypt(message)
33
+
34
+ print("Encrypted:")
35
+ print(crypt)
36
+
37
+ print("\nKey:")
38
+ print(key)
39
+
40
+ original = decrypt(crypt, key)
41
+
42
+ print("\nDecrypted:")
43
+ print(original)
44
+ ```
45
+
46
+ Output:
47
+
48
+ ```
49
+ Encrypted:
50
+ <encrypted data>
51
+
52
+ Key:
53
+ <secret key>
54
+
55
+ Decrypted:
56
+ Hello. We are looking for highly intelligent individuals.
57
+ ```
58
+
59
+ ---
60
+
61
+ # Features
62
+
63
+ - Symmetric key encryption
64
+ - Byte-oriented processing
65
+ - UTF-8 message support
66
+ - Random cryptographic key generation
67
+ - Base64 encoded output
68
+ - Simple Python API
69
+ - Lightweight implementation
70
+
71
+ ---
72
+
73
+ # API Reference
74
+
75
+ ## `encrypt()`
76
+
77
+ ```python
78
+ encrypt(msg: str) -> tuple[str, str]
79
+ ```
80
+
81
+ Encrypts a message and generates a random key.
82
+
83
+ ### Arguments
84
+
85
+ | Argument | Type | Description |
86
+ |-|-|-|
87
+ | `msg` | `str` | Message to encrypt |
88
+
89
+ ### Returns
90
+
91
+ A tuple containing:
92
+
93
+ ```python
94
+ (
95
+ encrypted_message,
96
+ encryption_key
97
+ )
98
+ ```
99
+
100
+ Both values are encoded using Base64.
101
+
102
+ Example:
103
+
104
+ ```python
105
+ crypt, key = encrypt("Hello")
106
+ ```
107
+
108
+ ---
109
+
110
+ ## `decrypt()`
111
+
112
+ ```python
113
+ decrypt(crypt: str, key: str) -> str
114
+ ```
115
+
116
+ Decrypts a Lemonade encrypted message using its key.
117
+
118
+ ### Arguments
119
+
120
+ | Argument | Type | Description |
121
+ |-|-|-|
122
+ | `crypt` | `str` | Encrypted message in Base64 |
123
+ | `key` | `str` | Encryption key in Base64 |
124
+
125
+ ### Returns
126
+
127
+ The original message:
128
+
129
+ ```python
130
+ str
131
+ ```
132
+
133
+ Example:
134
+
135
+ ```python
136
+ message = decrypt(crypt, key)
137
+ ```
138
+
139
+ ---
140
+
141
+ # How It Works
142
+
143
+ Lemonade operates directly on byte values.
144
+
145
+ Example:
146
+
147
+ ```
148
+ A = 65
149
+ B = 66
150
+ C = 67
151
+ ```
152
+
153
+ The encryption operation is:
154
+
155
+ ```
156
+ C = (M - K) mod 256
157
+ ```
158
+
159
+ Where:
160
+
161
+ | Symbol | Meaning |
162
+ |-|-|
163
+ | `C` | Encrypted byte |
164
+ | `M` | Original message byte |
165
+ | `K` | Key byte |
166
+
167
+ The decryption operation reverses the transformation:
168
+
169
+ ```
170
+ M = (C + K) mod 256
171
+ ```
172
+
173
+ More technical details can be found in:
174
+
175
+ ```
176
+ docs/algorithm.md
177
+ ```
178
+
179
+ ---
180
+
181
+ # Security Notice
182
+
183
+ Lemonade Cryptography is an experimental encryption library created for educational purposes and lightweight applications.
184
+
185
+ It is not intended to replace modern cryptographic standards such as AES or ChaCha20 in security-critical systems.
186
+
187
+ Always protect your encryption keys. Without the correct key, encrypted messages cannot be recovered.
188
+
189
+ ---
190
+
191
+ # License
192
+
193
+ Lemonade Cryptography is licensed under the MIT License.
@@ -0,0 +1,9 @@
1
+ from .crypto import encrypt, decrypt
2
+ from .version import __version__
3
+
4
+ __all__ = [
5
+ "encrypt",
6
+ "decrypt",
7
+ "__version__"
8
+ ]
9
+
@@ -0,0 +1,112 @@
1
+ import base64
2
+ import binascii
3
+ import secrets
4
+
5
+ from . import exceptions as e
6
+
7
+
8
+ def encrypt(msg: str) -> tuple[str, str]:
9
+ """Encrypts a message using Lemonade Encryption.
10
+
11
+ Generates a random key with the same byte length as the message.
12
+
13
+ Args:
14
+ msg (str): Text to be encrypted.
15
+
16
+ Returns:
17
+ tuple[str, str]: Encrypted message and its key.
18
+
19
+ Raises:
20
+ LemonadeError: When the message is invalid.
21
+ """
22
+
23
+ if not isinstance(msg, str):
24
+ raise e.LemonadeError("Message must be a string.")
25
+
26
+ try:
27
+ msg_bytes = msg.encode("utf-8")
28
+ except UnicodeEncodeError as error:
29
+ raise e.LemonadeError(
30
+ "Unable to encode message as UTF-8."
31
+ ) from error
32
+
33
+ key_bytes = secrets.token_bytes(len(msg_bytes))
34
+
35
+ crypt_bytes = bytes(
36
+ (msg_bytes[i] - key_bytes[i]) % 256
37
+ for i in range(len(msg_bytes))
38
+ )
39
+
40
+ crypt = base64.b64encode(crypt_bytes).decode("ascii")
41
+ key = base64.b64encode(key_bytes).decode("ascii")
42
+
43
+ return crypt, key
44
+
45
+
46
+ def decrypt(crypt: str, key: str) -> str:
47
+ """Decrypts a Lemonade encrypted message.
48
+
49
+ Args:
50
+ crypt (str): Encrypted message in Base64.
51
+ key (str): Encryption key in Base64.
52
+
53
+ Returns:
54
+ str: Decrypted original message.
55
+
56
+ Raises:
57
+ InvalidCipherError: When the encrypted message is invalid.
58
+ InvalidKeyError: When the key is invalid.
59
+ LemonadeError: When decryption fails.
60
+ """
61
+
62
+ if not isinstance(crypt, str):
63
+ raise e.InvalidCipherError(
64
+ "Cipher must be a string."
65
+ )
66
+
67
+ if not isinstance(key, str):
68
+ raise e.InvalidKeyError(
69
+ "Key must be a string."
70
+ )
71
+
72
+ try:
73
+ crypt_bytes = base64.b64decode(
74
+ crypt,
75
+ validate=True
76
+ )
77
+ except (binascii.Error, ValueError) as error:
78
+ raise e.InvalidCipherError(
79
+ "Invalid cryptography."
80
+ ) from error
81
+
82
+ try:
83
+ key_bytes = base64.b64decode(
84
+ key,
85
+ validate=True
86
+ )
87
+ except (binascii.Error, ValueError) as error:
88
+ raise e.InvalidKeyError(
89
+ "Invalid encryption key."
90
+ ) from error
91
+
92
+ if len(key_bytes) != len(crypt_bytes):
93
+ raise e.InvalidKeyError(
94
+ "Encryption key length does not match cipher length."
95
+ )
96
+
97
+ try:
98
+ msg_bytes = bytes(
99
+ (crypt_bytes[i] + key_bytes[i]) % 256
100
+ for i in range(len(crypt_bytes))
101
+ )
102
+ except IndexError as error:
103
+ raise e.LemonadeError(
104
+ "Error while decrypting cipher."
105
+ ) from error
106
+
107
+ try:
108
+ return msg_bytes.decode("utf-8")
109
+ except UnicodeDecodeError as error:
110
+ raise e.LemonadeError(
111
+ "Decrypted data is not valid UTF-8."
112
+ ) from error
@@ -0,0 +1,10 @@
1
+ class LemonadeError(Exception):
2
+ pass
3
+
4
+
5
+ class InvalidKeyError(LemonadeError):
6
+ pass
7
+
8
+
9
+ class InvalidCipherError(LemonadeError):
10
+ pass
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,225 @@
1
+ Metadata-Version: 2.4
2
+ Name: lemonade-cryptography
3
+ Version: 1.0.0
4
+ Summary: Lightweight byte-oriented encryption library.
5
+ Author: Vlinho
6
+ License: MIT License
7
+
8
+ Copyright 2026 Vlinho
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the “Software”), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ SOFTWARE.
25
+ Keywords: cryptography,encryption,experimental
26
+ Classifier: Programming Language :: Python :: 3
27
+ Classifier: Operating System :: OS Independent
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Dynamic: license-file
32
+
33
+ # 🍋 Lemonade Cryptography
34
+
35
+ **Lemonade Cryptography** is a lightweight byte-oriented encryption library based on modular arithmetic and symmetric key transformations.
36
+
37
+ Lemonade transforms readable messages into encrypted data by converting text into bytes and applying mathematical operations using a cryptographic key.
38
+
39
+ The core concept is:
40
+
41
+ > Each byte of the message is encrypted by subtracting it from a corresponding byte of a secret key.
42
+
43
+ The original message can be recovered by applying the reverse operation using the same key.
44
+
45
+ ---
46
+
47
+ # Installation
48
+
49
+ Install Lemonade Cryptography using pip:
50
+
51
+ ```bash
52
+ pip install lemonade-cryptography
53
+ ```
54
+
55
+ ---
56
+
57
+ # Quick Start
58
+
59
+ ```python
60
+ from lemonade import encrypt, decrypt
61
+
62
+ message = "Hello. We are looking for highly intelligent individuals."
63
+
64
+ crypt, key = encrypt(message)
65
+
66
+ print("Encrypted:")
67
+ print(crypt)
68
+
69
+ print("\nKey:")
70
+ print(key)
71
+
72
+ original = decrypt(crypt, key)
73
+
74
+ print("\nDecrypted:")
75
+ print(original)
76
+ ```
77
+
78
+ Output:
79
+
80
+ ```
81
+ Encrypted:
82
+ <encrypted data>
83
+
84
+ Key:
85
+ <secret key>
86
+
87
+ Decrypted:
88
+ Hello. We are looking for highly intelligent individuals.
89
+ ```
90
+
91
+ ---
92
+
93
+ # Features
94
+
95
+ - Symmetric key encryption
96
+ - Byte-oriented processing
97
+ - UTF-8 message support
98
+ - Random cryptographic key generation
99
+ - Base64 encoded output
100
+ - Simple Python API
101
+ - Lightweight implementation
102
+
103
+ ---
104
+
105
+ # API Reference
106
+
107
+ ## `encrypt()`
108
+
109
+ ```python
110
+ encrypt(msg: str) -> tuple[str, str]
111
+ ```
112
+
113
+ Encrypts a message and generates a random key.
114
+
115
+ ### Arguments
116
+
117
+ | Argument | Type | Description |
118
+ |-|-|-|
119
+ | `msg` | `str` | Message to encrypt |
120
+
121
+ ### Returns
122
+
123
+ A tuple containing:
124
+
125
+ ```python
126
+ (
127
+ encrypted_message,
128
+ encryption_key
129
+ )
130
+ ```
131
+
132
+ Both values are encoded using Base64.
133
+
134
+ Example:
135
+
136
+ ```python
137
+ crypt, key = encrypt("Hello")
138
+ ```
139
+
140
+ ---
141
+
142
+ ## `decrypt()`
143
+
144
+ ```python
145
+ decrypt(crypt: str, key: str) -> str
146
+ ```
147
+
148
+ Decrypts a Lemonade encrypted message using its key.
149
+
150
+ ### Arguments
151
+
152
+ | Argument | Type | Description |
153
+ |-|-|-|
154
+ | `crypt` | `str` | Encrypted message in Base64 |
155
+ | `key` | `str` | Encryption key in Base64 |
156
+
157
+ ### Returns
158
+
159
+ The original message:
160
+
161
+ ```python
162
+ str
163
+ ```
164
+
165
+ Example:
166
+
167
+ ```python
168
+ message = decrypt(crypt, key)
169
+ ```
170
+
171
+ ---
172
+
173
+ # How It Works
174
+
175
+ Lemonade operates directly on byte values.
176
+
177
+ Example:
178
+
179
+ ```
180
+ A = 65
181
+ B = 66
182
+ C = 67
183
+ ```
184
+
185
+ The encryption operation is:
186
+
187
+ ```
188
+ C = (M - K) mod 256
189
+ ```
190
+
191
+ Where:
192
+
193
+ | Symbol | Meaning |
194
+ |-|-|
195
+ | `C` | Encrypted byte |
196
+ | `M` | Original message byte |
197
+ | `K` | Key byte |
198
+
199
+ The decryption operation reverses the transformation:
200
+
201
+ ```
202
+ M = (C + K) mod 256
203
+ ```
204
+
205
+ More technical details can be found in:
206
+
207
+ ```
208
+ docs/algorithm.md
209
+ ```
210
+
211
+ ---
212
+
213
+ # Security Notice
214
+
215
+ Lemonade Cryptography is an experimental encryption library created for educational purposes and lightweight applications.
216
+
217
+ It is not intended to replace modern cryptographic standards such as AES or ChaCha20 in security-critical systems.
218
+
219
+ Always protect your encryption keys. Without the correct key, encrypted messages cannot be recovered.
220
+
221
+ ---
222
+
223
+ # License
224
+
225
+ Lemonade Cryptography is licensed under the MIT License.
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ lemonade/__init__.py
5
+ lemonade/crypto.py
6
+ lemonade/exceptions.py
7
+ lemonade/version.py
8
+ lemonade_cryptography.egg-info/PKG-INFO
9
+ lemonade_cryptography.egg-info/SOURCES.txt
10
+ lemonade_cryptography.egg-info/dependency_links.txt
11
+ lemonade_cryptography.egg-info/top_level.txt
12
+ tests/test_crypto.py
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "lemonade-cryptography"
7
+ version = "1.0.0"
8
+ description = "Lightweight byte-oriented encryption library."
9
+ readme = "README.md"
10
+ license = { file = "LICENSE" }
11
+ requires-python = ">=3.10"
12
+
13
+ authors = [
14
+ {name="Vlinho"}
15
+ ]
16
+
17
+ keywords = [
18
+ "cryptography",
19
+ "encryption",
20
+ "experimental"
21
+ ]
22
+
23
+ classifiers = [
24
+ "Programming Language :: Python :: 3",
25
+ "Operating System :: OS Independent"
26
+ ]
27
+
28
+ [tool.setuptools]
29
+ packages = ["lemonade"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,38 @@
1
+ import pytest
2
+ from lemonade import encrypt, decrypt
3
+ from lemonade.exceptions import InvalidKeyError
4
+
5
+
6
+ def test_invalid_key():
7
+ with pytest.raises(InvalidKeyError):
8
+ decrypt("YWJj", "invalid")
9
+
10
+
11
+ def test_basic_encryption():
12
+ message = "Hello Lemonade"
13
+ crypt, key = encrypt(message)
14
+ result = decrypt(crypt, key)
15
+
16
+ assert result == message
17
+
18
+
19
+ def test_unicode():
20
+ message = "🍋 Se a vida te der limões, faça uma limonada >w< 世界"
21
+ crypt, key = encrypt(message)
22
+
23
+ assert decrypt(crypt, key) == message
24
+
25
+
26
+ def test_long_message():
27
+ message = "LIMÃO" * 2000
28
+ crypt, key = encrypt(message)
29
+
30
+ assert decrypt(crypt, key) == message
31
+
32
+
33
+ def test_empty_message():
34
+ message = ""
35
+ crypt, key = encrypt(message)
36
+
37
+ assert decrypt(crypt, key) == message
38
+