Skip to main content

Dynamic Data Encryption Standard (D-DES) with a single dynamic S-box.

Project description

D-DES (Dynamic Data Encryption Standard)

⚠️ Security Disclaimer: This is an experimental cryptographic tool for research and educational purposes. It is not intended for securing sensitive production data.

D-DES is a custom implementation of the classic DES (Data Encryption Standard) block cipher, modified to feature a Dynamic S-Box.

Requirements

  • Python 3.8+: This library leverages Python type hinting and bit-manipulation features. Ensure you are running Python 3.8 or higher.

Features

  • Standard 64-bit block size and 56-bit effective key.
  • 16 Feistel rounds with standard permutation tables (IP, IP-1, E, P, PC-1, PC-2).
  • Dynamic S-Box: Replaces the 8 static S-boxes with a single, dynamically generated $6 \times 4$ S-box completely seeded by the encryption key.
  • CBC Mode Support: Prevents repeating data blocks by utilizing an Initialization Vector (IV).
  • PKCS#7 Padding: Safely encrypts and decrypts files of any arbitrary size.
  • CLI Utility: Built-in command line interface to seamlessly encrypt/decrypt any file on your computer.
  • Operational Logger: Automatically and securely logs operation metadata to a logs.json file without leaking secrets or plaintext.

Installation

You can install the package directly from PyPI. In your terminal, run:

pip install ddes-dua-crypto

CLI Usage

The package installs a globally available ddes-cli tool.

To encrypt a file (CBC mode):

ddes-cli encrypt -k "8bytekey" -m CBC --iv "8byte_iv" -i plaintext.txt -o encrypted.bin

To decrypt a file:

ddes-cli decrypt -k "8bytekey" -m CBC --iv "8byte_iv" -i encrypted.bin -o decrypted.txt

Python API Usage

You can also use the cipher directly inside your own Python projects.

from ddes import DDESCipher

# 8-byte key and IV
key = b'8bytekey'
iv = b'8byte_iv'

# Initialize in CBC mode
cipher = DDESCipher(key, mode='CBC', iv=iv)

# Encrypt
plaintext = b'Hello World! This is D-DES.'
ciphertext = cipher.encrypt(plaintext)
print(f"Ciphertext (Hex): {ciphertext.hex()}")

# Decrypt
decrypted = cipher.decrypt(ciphertext)
print(f"Decrypted: {decrypted.decode('utf-8')}")

Operational Logger

All CLI encryption and decryption commands automatically append an audit trail to logs.json. The logger securely stores the timestamp, operation type, mode, and success status. It never stores keys or file contents.

Example Audit Log (logs.json):

[
    {
        "timestamp": "2026-05-08T19:02:15.123456",
        "operation": "Encrypt",
        "mode": "CBC",
        "status": "Success"
    }
]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ddes_dua_crypto-0.1.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ddes_dua_crypto-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file ddes_dua_crypto-0.1.1.tar.gz.

File metadata

  • Download URL: ddes_dua_crypto-0.1.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for ddes_dua_crypto-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e7acaf42a5dd63d25e962c23ca8b7454dc735c9db65e7cf9ab11b972390e4907
MD5 0ceea609a43ad0b7712a583f7acd2467
BLAKE2b-256 f54e18da29ff8f0711942d4dc0f5ac18a8aabf94f707fc329952ea5b140fb924

See more details on using hashes here.

File details

Details for the file ddes_dua_crypto-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ddes_dua_crypto-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa419acc822ad41d65b42b633b2f21c0e0a1093592820e1b49e70ee7994d8647
MD5 ca19d1c1e74f3eed0eed54c651abb318
BLAKE2b-256 5068664131afb2f06fddf821106ca22b20572f810b9dde88236ccf24db324154

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page