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.13.3+: This library leverages modern Python type hinting and bit-manipulation features. Ensure you are running Python 3.13.3 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.0.tar.gz (8.7 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.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ddes_dua_crypto-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 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.0.tar.gz
Algorithm Hash digest
SHA256 ce08a4d084a7d0ba959554fb585f3d48341c32439ab4b6bcaed44362e4bdf4b3
MD5 df36390e419623d709c82222cd5ad4c6
BLAKE2b-256 10f7d28bd6a63dccdbd79e13a8f2623150a9d7b0ea7156df539bb243e07b55fd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ddes_dua_crypto-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 deb82415e9cc920fc09f22772b3ded223fc78c1dae480a455fef010375bdec29
MD5 ec0e0d163c0e5972ad943f07c1bf3f15
BLAKE2b-256 6cfbcffdae396088b1f459dd3c3e5575c45a24da0508ce2ff4aa13da30a2e950

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