Skip to main content

DES-Python

made-with-python license: AGPL-3.0 DES-Python PyPI Downloads

Data Encryption Standard (DES) implemented in pure Python

Demo

Features

  • Encryption and Decryption
  • PKCS5 Padding
  • ECB Mode of Operation
  • Hex String and Bytes Object Support

Installation

Install using your Python package manager of choice:

pip install des_PurePy

Documentation

Full documentation: https://perez-herrera-luna.github.io/DES-Python/

Usage

Encrypting Hex Strings

Define a DES object while passing in your key. The key can be a hex string or a bytes object.

import des_PurePy
des = des_PurePy.DES("0x133457799bbcdff1")

You can encrypt by calling encrypt() and passing in a hex string or bytes object.

des.encrypt("0x0123456789abcdef")    # -> "0x85e813540f0ab405fdf2e174492922f8"

You can simarly decrypt by calling decrypt() and passing in a hex string or bytes object.

des.decrypt("0x85e813540f0ab405fdf2e174492922f8")    # -> "0x0123456789abcdef"

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.

Encrypting Bytes Objects and Text

Inputs can be hex strings or bytes objects. The key must always be 8 bytes but the encryption input can have any size. Because of the bytes object support, with some work, you can encrypt and decrypt text.

import des_PurePy

key = b"password"
des = des_PurePy.DES(key)

ciphertext = des.encrypt(b"secret message")                 # -> "0x0d417ca7d23582bab5e2c9277f801591"
cleartext = des.decrypt(ciphertext)                         # -> "0x736563726574206d657373616765"
cleartext = bytes.fromhex(cleartext[2:]).decode("utf-8")    # -> "secret message"

Note that all input is validated so if you pass in an inapropriate input the module will raise a corresponding error.

Metadata

Release files for des-PurePy 1.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for des-PurePy 1.0.16
File Size Uploaded
des_purepy-1.0.16.tar.gz 37.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for des-PurePy 1.0.16
File Interpreter ABI Platform
des_purepy-1.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 69.2 kB

Release files / des_purepy-1.0.16.tar.gz

Download URL des_purepy-1.0.16.tar.gz
Size 37.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c520d62495ba18ecb8ed9a7c9e3956a4acaf4b38fb80facdb0f31e1177783801
BLAKE2b-256 checksum
How to use checksums
f705a8668b6bd02ce44c752270deb907d0dc46edf8a60a72d8a88f795dc235e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release files / des_purepy-1.0.16-py3-none-any.whl

Download URL des_purepy-1.0.16-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09721d02867fc4703950b71bc0155939cecc03b4209da3cdb0feb452dd8b2fce
BLAKE2b-256 checksum
How to use checksums
9792dcacf403473092068a54d01dbae09b55e090ff174f554c021592d645c698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.16 This release

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page