Skip to main content

Simplified Data Encryption Standard (S-DES) Implementation

Project description

S-DES (Simplified Data Encryption Standard)

S-DES (Simplified Data Encryption Standard) is a lightweight block cipher that operates on 8-bit blocks. This package implements the encryption and decryption functionality of S-DES using a 10-bit key.

Installation

To install the package, you can use the following pip command:

pip install sdes
pip install bitarray

If you are developing locally, you can install the package in editable mode:

pip install -e .

Usage

You can use this package to perform encryption and decryption using the Simplified Data Encryption Standard (S-DES) algorithm.

Example Usage

from sdes import encrypt, decrypt, generate_keys
import bitarray

# Example 10-bit key (must be 10-bits long)
key = bitarray('1010000010')

# Example 8-bit plaintext (must be 8-bits long)
plaintext = bitarray('11010011')

# Generate subkeys
key1, key2 = generate_keys(key)

# Encrypt the plaintext
ciphertext = encrypt(plaintext, key1, key2)
print("Encrypted:", ciphertext)

# Decrypt the ciphertext
decrypted_text = decrypt(ciphertext, key1, key2)
print("Decrypted:", decrypted_text)

Functions

  • generate_keys(key)
    Generates two 8-bit subkeys (key1 and key2) from the provided 10-bit key.

    Parameters:

    • key (bitarray): The 10-bit key.

    Returns:

    • key1 (bitarray): First subkey.
    • key2 (bitarray): Second subkey.
  • encrypt(plaintext, key1, key2)
    Encrypts the 8-bit plaintext using the two subkeys (key1 and key2) according to the S-DES algorithm.

    Parameters:

    • plaintext (bitarray): The 8-bit plaintext to encrypt.
    • key1 (bitarray): First subkey.
    • key2 (bitarray): Second subkey.

    Returns:

    • ciphertext (bitarray): The encrypted 8-bit ciphertext.
  • decrypt(ciphertext, key1, key2)
    Decrypts the 8-bit ciphertext using the two subkeys (key1 and key2) according to the S-DES algorithm.

    Parameters:

    • ciphertext (bitarray): The 8-bit ciphertext to decrypt.
    • key1 (bitarray): First subkey.
    • key2 (bitarray): Second subkey.

    Returns:

    • decrypted_text (bitarray): The decrypted 8-bit plaintext.

Requirements

This package requires the following libraries:

  • bitarray: A Python module for efficiently working with bit arrays.
  • numpy: A package for numerical computations (optional for your case but can be useful for optimization).

You can install the dependencies using:

pip install bitarray numpy

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Feel free to open issues and submit pull requests. Contributions are welcome!

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

sdes-0.1.2.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

sdes-0.1.2-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file sdes-0.1.2.tar.gz.

File metadata

  • Download URL: sdes-0.1.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for sdes-0.1.2.tar.gz
Algorithm Hash digest
SHA256 14c3380aa19303622bd90493073ba2564eb5dfb619c88bd33b6443870c0998ae
MD5 3107f95b2aa7d2c0d7303c92de4ee15a
BLAKE2b-256 be3bce8b3d74d21120a0080afe36d6ab4fe19d26964223e7dee4c36534e3b226

See more details on using hashes here.

File details

Details for the file sdes-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: sdes-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for sdes-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 502d2456caf8953f566cca614ef36281e0ae6c7ccec11334a512a3b9ecf7a64b
MD5 710ed702c727501801ea6bdfdde6e3a1
BLAKE2b-256 344bdde2fa2044764c04c7b254918cfb5b0e2d920301ab674644a26adf69f5f7

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