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.bitarray('1010000010')

# Example 8-bit plaintext (must be 8-bits long)
plaintext = bitarray.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.3.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.3-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sdes-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 af14edd2cede31e1f5738df8d9310cd2f15d8b7600b39a819c1743ada1cc0b36
MD5 01192516118202be78a66de0b983f440
BLAKE2b-256 a06a60a87346fde9b85c4a48c2f60c191e796f2fd2560929b70d087e22e8a3d5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sdes-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 91e673adea1621294ac790b866dbc1e82172d346da58959e62485e38eb53f2a6
MD5 2bb40d943fb783f11c23edfa5958ae4b
BLAKE2b-256 4ac2ccb6e1b251e6d3e956f64effbabed51fd40734cd0d7ba6b205c0c13bd619

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