larax 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.
- larax-1.0.0/PKG-INFO +45 -0
- larax-1.0.0/larax/__init__.py +43 -0
- larax-1.0.0/larax.egg-info/PKG-INFO +45 -0
- larax-1.0.0/larax.egg-info/SOURCES.txt +6 -0
- larax-1.0.0/larax.egg-info/dependency_links.txt +1 -0
- larax-1.0.0/larax.egg-info/top_level.txt +1 -0
- larax-1.0.0/setup.cfg +4 -0
- larax-1.0.0/setup.py +57 -0
larax-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: larax
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A powerful encryption library
|
|
5
|
+
Author: ALI K
|
|
6
|
+
Author-email: wzcnsn@gmail.com
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: author-email
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: summary
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# lara
|
|
18
|
+
|
|
19
|
+
Install library:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install larax
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use library:
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
|
|
29
|
+
import larax
|
|
30
|
+
|
|
31
|
+
# 1. Define inputs and secret key
|
|
32
|
+
secret_key = 'my key'
|
|
33
|
+
plain_text = 'hello'
|
|
34
|
+
|
|
35
|
+
# 2. Encrypt the data
|
|
36
|
+
encrypted_data = larax.dump(plain_text, secret_key)
|
|
37
|
+
print("Encrypted:", encrypted_data)
|
|
38
|
+
|
|
39
|
+
# 3. Decrypt the data
|
|
40
|
+
decrypted_text = larax.load(encrypted_data, secret_key)
|
|
41
|
+
print("Decrypted:", decrypted_text)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
|
|
3
|
+
def _generate_keystream(key: str, length: int) -> bytes:
|
|
4
|
+
|
|
5
|
+
keystream = bytearray()
|
|
6
|
+
counter = 0
|
|
7
|
+
|
|
8
|
+
while len(keystream) < length:
|
|
9
|
+
|
|
10
|
+
block = hashlib.sha256(f"{key}:{counter}".encode('utf-8')).digest()
|
|
11
|
+
keystream.extend(block)
|
|
12
|
+
counter += 1
|
|
13
|
+
|
|
14
|
+
return bytes(keystream[:length])
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def dump(data: str, key: str) -> str:
|
|
18
|
+
|
|
19
|
+
data_bytes = data.encode('utf-8')
|
|
20
|
+
|
|
21
|
+
keystream = _generate_keystream(key, len(data_bytes))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
encrypted_bytes = bytes([b ^ k for b, k in zip(data_bytes, keystream)])
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
return encrypted_bytes.hex()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def load(hex_data: str, key: str) -> str:
|
|
31
|
+
|
|
32
|
+
encrypted_bytes = bytes.fromhex(hex_data)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
keystream = _generate_keystream(key, len(encrypted_bytes))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
decrypted_bytes = bytes([b ^ k for b, k in zip(encrypted_bytes, keystream)])
|
|
39
|
+
|
|
40
|
+
return decrypted_bytes.decode('utf-8')
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: larax
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A powerful encryption library
|
|
5
|
+
Author: ALI K
|
|
6
|
+
Author-email: wzcnsn@gmail.com
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: author-email
|
|
10
|
+
Dynamic: description
|
|
11
|
+
Dynamic: description-content-type
|
|
12
|
+
Dynamic: summary
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# lara
|
|
18
|
+
|
|
19
|
+
Install library:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install larax
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use library:
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
|
|
29
|
+
import larax
|
|
30
|
+
|
|
31
|
+
# 1. Define inputs and secret key
|
|
32
|
+
secret_key = 'my key'
|
|
33
|
+
plain_text = 'hello'
|
|
34
|
+
|
|
35
|
+
# 2. Encrypt the data
|
|
36
|
+
encrypted_data = larax.dump(plain_text, secret_key)
|
|
37
|
+
print("Encrypted:", encrypted_data)
|
|
38
|
+
|
|
39
|
+
# 3. Decrypt the data
|
|
40
|
+
decrypted_text = larax.load(encrypted_data, secret_key)
|
|
41
|
+
print("Decrypted:", decrypted_text)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
larax
|
larax-1.0.0/setup.cfg
ADDED
larax-1.0.0/setup.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from setuptools import setup,find_packages
|
|
2
|
+
|
|
3
|
+
d="""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# lara
|
|
7
|
+
|
|
8
|
+
Install library:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install larax
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Use library:
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
|
|
18
|
+
import larax
|
|
19
|
+
|
|
20
|
+
# 1. Define inputs and secret key
|
|
21
|
+
secret_key = 'my key'
|
|
22
|
+
plain_text = 'hello'
|
|
23
|
+
|
|
24
|
+
# 2. Encrypt the data
|
|
25
|
+
encrypted_data = larax.dump(plain_text, secret_key)
|
|
26
|
+
print("Encrypted:", encrypted_data)
|
|
27
|
+
|
|
28
|
+
# 3. Decrypt the data
|
|
29
|
+
decrypted_text = larax.load(encrypted_data, secret_key)
|
|
30
|
+
print("Decrypted:", decrypted_text)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
setup(
|
|
43
|
+
version='1.0.0',
|
|
44
|
+
name='larax',
|
|
45
|
+
author='ALI K',
|
|
46
|
+
description='A powerful encryption library',
|
|
47
|
+
author_email='wzcnsn@gmail.com',
|
|
48
|
+
packages=find_packages(),
|
|
49
|
+
long_description=d,
|
|
50
|
+
long_description_content_type='text/markdown',
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|