des-PurePy 1.0.7__tar.gz → 1.0.8__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.
@@ -1,39 +1,39 @@
1
- # This workflow will install Python dependencies, run tests and lint with a single version of Python
2
- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
-
4
- name: DES-Python
5
-
6
- on:
7
- push:
8
- branches: [ "main" ]
9
- pull_request:
10
- branches: [ "main" ]
11
-
12
- permissions:
13
- contents: read
14
-
15
- jobs:
16
- build:
17
-
18
- runs-on: ubuntu-latest
19
-
20
- steps:
21
- - uses: actions/checkout@v4
22
- - name: Set up Python 3.10
23
- uses: actions/setup-python@v3
24
- with:
25
- python-version: "3.10"
26
- - name: Install dependencies
27
- run: |
28
- python -m pip install --upgrade pip
29
- pip install flake8 pytest
30
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31
- - name: Lint with flake8
32
- run: |
33
- # stop the build if there are Python syntax errors or undefined names
34
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37
- - name: Test with pytest
38
- run: |
39
- pytest test.py
1
+ # This workflow will install Python dependencies, run tests and lint with a single version of Python
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
+
4
+ name: DES-Python
5
+
6
+ on:
7
+ push:
8
+ branches: [ "main" ]
9
+ pull_request:
10
+ branches: [ "main" ]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ build:
17
+
18
+ runs-on: ubuntu-latest
19
+
20
+ steps:
21
+ - uses: actions/checkout@v4
22
+ - name: Set up Python 3.10
23
+ uses: actions/setup-python@v3
24
+ with:
25
+ python-version: "3.10"
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install flake8 pytest des_PurePy
30
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31
+ - name: Lint with flake8
32
+ run: |
33
+ # stop the build if there are Python syntax errors or undefined names
34
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35
+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36
+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37
+ - name: Test with pytest
38
+ run: |
39
+ pytest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: des_PurePy
3
- Version: 1.0.7
3
+ Version: 1.0.8
4
4
  Summary: A pure python implementation of DES
5
5
  Project-URL: Homepage, https://github.com/Perez-Herrera-Luna/DES-Python
6
6
  Author-email: Luna Perez-Herrera <lunaperezherrer@gmail.com>
@@ -21,19 +21,26 @@ Data Encryption Standard (DES) implemented in pure Python
21
21
 
22
22
  ![Demo](https://github.com/user-attachments/assets/aaa905df-d924-4d52-80f4-b06390c1b523)
23
23
 
24
+ ## Features
25
+
26
+ - **Encryption and Decryption**
27
+ - **PKCS5 Padding**
28
+ - **ECB Mode of Operation**
29
+ - **Hex String and Bytes Object Support**
30
+
24
31
  ## Installation
25
32
 
26
33
  Install using your Python package manager of choice:
27
34
  ```bash
28
- pip install des_Py
35
+ pip install des_PurePy
29
36
  ```
30
37
 
31
38
  ## Usage
32
39
  ### Encrypting Hex Strings
33
40
  Define a `DES` object while passing in your key. The key can be a hex string or a bytes object.
34
41
  ```python
35
- import des_Py
36
- des = des_Py.DES("0x133457799bbcdff1")
42
+ import des_PurePy
43
+ des = des_PurePy.DES("0x133457799bbcdff1")
37
44
  ```
38
45
  You can encrypt by calling `encrypt()` and passing in a hex string or bytes object.
39
46
  ```python
@@ -43,3 +50,18 @@ You can simarly decrypt by calling `decrypt()` and passing in a hex string or by
43
50
  ```python
44
51
  des.decrypt("0x85e813540f0ab405fdf2e174492922f8") # -> "0x0123456789abcdef"
45
52
  ```
53
+ By default, encryption input is padded to a multiple of the block size (8 bytes) according to PKCS5. Inputs that are multiple blocks long are encrypted using the Electronic Code Book (ECB) mode of operation.
54
+ ### Encrypting Bytes Objects and Text
55
+ Inputs can be hex strings or bytes objects. The key must always be 8 bytes but the encryption input can have any size.
56
+ Because of the bytes object support, with some work, you can encrypt and decrypt text.
57
+ ```python
58
+ import des_PurePy
59
+
60
+ key = b"password"
61
+ des = des_PurePy.DES(key)
62
+
63
+ ciphertext = des.encrypt(b"secret message") # -> "0x0d417ca7d23582bab5e2c9277f801591"
64
+ cleartext = des.decrypt(ciphertext) # -> "0x736563726574206d657373616765"
65
+ cleartext = bytes.fromhex(cleartext[2:]).decode("utf-8") # -> "secret message"
66
+ ```
67
+ Note that all input is validated so if you passing in an inapropriate input the module will raise a corresponding error.
@@ -0,0 +1,54 @@
1
+ # DES-Python
2
+
3
+ ![made-with-python](https://img.shields.io/badge/Made%20with-Python%203-1f425f.svg)
4
+ [![license: AGPL-3.0](https://img.shields.io/github/license/Perez-Herrera-Luna/DES-Python.svg)](https://github.com/Perez-Herrera-Luna/DES-Python/blob/main/LICENSE)
5
+ [![DES-Python](https://github.com/Perez-Herrera-Luna/DES-Python/actions/workflows/python-app.yml/badge.svg)](https://github.com/Perez-Herrera-Luna/DES-Python/actions/workflows/python-app.yml)
6
+
7
+ Data Encryption Standard (DES) implemented in pure Python
8
+
9
+ ![Demo](https://github.com/user-attachments/assets/aaa905df-d924-4d52-80f4-b06390c1b523)
10
+
11
+ ## Features
12
+
13
+ - **Encryption and Decryption**
14
+ - **PKCS5 Padding**
15
+ - **ECB Mode of Operation**
16
+ - **Hex String and Bytes Object Support**
17
+
18
+ ## Installation
19
+
20
+ Install using your Python package manager of choice:
21
+ ```bash
22
+ pip install des_PurePy
23
+ ```
24
+
25
+ ## Usage
26
+ ### Encrypting Hex Strings
27
+ Define a `DES` object while passing in your key. The key can be a hex string or a bytes object.
28
+ ```python
29
+ import des_PurePy
30
+ des = des_PurePy.DES("0x133457799bbcdff1")
31
+ ```
32
+ You can encrypt by calling `encrypt()` and passing in a hex string or bytes object.
33
+ ```python
34
+ des.encrypt("0x0123456789abcdef") # -> "0x85e813540f0ab405fdf2e174492922f8"
35
+ ```
36
+ You can simarly decrypt by calling `decrypt()` and passing in a hex string or bytes object.
37
+ ```python
38
+ des.decrypt("0x85e813540f0ab405fdf2e174492922f8") # -> "0x0123456789abcdef"
39
+ ```
40
+ By default, encryption input is padded to a multiple of the block size (8 bytes) according to PKCS5. Inputs that are multiple blocks long are encrypted using the Electronic Code Book (ECB) mode of operation.
41
+ ### Encrypting Bytes Objects and Text
42
+ Inputs can be hex strings or bytes objects. The key must always be 8 bytes but the encryption input can have any size.
43
+ Because of the bytes object support, with some work, you can encrypt and decrypt text.
44
+ ```python
45
+ import des_PurePy
46
+
47
+ key = b"password"
48
+ des = des_PurePy.DES(key)
49
+
50
+ ciphertext = des.encrypt(b"secret message") # -> "0x0d417ca7d23582bab5e2c9277f801591"
51
+ cleartext = des.decrypt(ciphertext) # -> "0x736563726574206d657373616765"
52
+ cleartext = bytes.fromhex(cleartext[2:]).decode("utf-8") # -> "secret message"
53
+ ```
54
+ Note that all input is validated so if you passing in an inapropriate input the module will raise a corresponding error.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "des_PurePy"
3
- version = "1.0.7"
3
+ version = "1.0.8"
4
4
  authors = [
5
5
  { name="Luna Perez-Herrera", email="lunaperezherrer@gmail.com" },
6
6
  ]
@@ -1,32 +0,0 @@
1
- # DES-Python
2
-
3
- ![made-with-python](https://img.shields.io/badge/Made%20with-Python%203-1f425f.svg)
4
- [![license: AGPL-3.0](https://img.shields.io/github/license/Perez-Herrera-Luna/DES-Python.svg)](https://github.com/Perez-Herrera-Luna/DES-Python/blob/main/LICENSE)
5
- [![DES-Python](https://github.com/Perez-Herrera-Luna/DES-Python/actions/workflows/python-app.yml/badge.svg)](https://github.com/Perez-Herrera-Luna/DES-Python/actions/workflows/python-app.yml)
6
-
7
- Data Encryption Standard (DES) implemented in pure Python
8
-
9
- ![Demo](https://github.com/user-attachments/assets/aaa905df-d924-4d52-80f4-b06390c1b523)
10
-
11
- ## Installation
12
-
13
- Install using your Python package manager of choice:
14
- ```bash
15
- pip install des_Py
16
- ```
17
-
18
- ## Usage
19
- ### Encrypting Hex Strings
20
- Define a `DES` object while passing in your key. The key can be a hex string or a bytes object.
21
- ```python
22
- import des_Py
23
- des = des_Py.DES("0x133457799bbcdff1")
24
- ```
25
- You can encrypt by calling `encrypt()` and passing in a hex string or bytes object.
26
- ```python
27
- des.encrypt("0x0123456789abcdef") # -> "0x85e813540f0ab405fdf2e174492922f8"
28
- ```
29
- You can simarly decrypt by calling `decrypt()` and passing in a hex string or bytes object.
30
- ```python
31
- des.decrypt("0x85e813540f0ab405fdf2e174492922f8") # -> "0x0123456789abcdef"
32
- ```
File without changes
File without changes
File without changes