Skip to main content

About

bletchley is a pure Python cryptographic tool suite. It provides historical ciphers. In the future it will also provide cryptographic attacks (cryptanalysis) to use against these ciphers.

If you find an bug or have a feature you'd like to see, please raise an issue.

You can get in touch with us via this link.

The latest version of Bletchley is available via our GitLab repo, PyPi or Conda-forge.

Ciphers

Supported ciphers can be found on our wiki.

Simple Example

Ciphers can be accessed by adding bletchley to your Python path:

export PYTHONPATH=$PYTHONPATH:/path/to/bletchley

Then importing bletchley into your Python script:

from bletchley.ciphers.rot13_cipher import ROT13Cipher

And creating an instance of the cipher:

my_cipher = ROT13Cipher()

From here, you can encrypt and decrypt messages using the cipher:

my_message = "Hello World!"
cipher_text = my_cipher.encrypt(my_message)
plain_text = my_cipher.decrypt(cipher_text)

Advanced Example

All ciphers implement the abstract class: Cipher. This means that all ciphers have encrypt and decrypt functions you can use. Note that some more complex ciphers (such as the VIC Cipher) may have additional arguments when called. Where possible, these will be included with the cipher.

Taking the VIC cipher as an example, another argument is needed to encrypt/decrypt messages. This is called a 'checkerboard'. We can create our cipher in the same way as we did for the Caeser cipher before:

from bletchley.ciphers.vic_cipher import VICCipher
my_cipher = VICCipher()

Before we can encrypt/decrypt any message, a checkerboard is needed. We now have two options:

  1. Create our own checkerboard
  2. Let the VIC cipher generate a random checkerboard for us

For now we will choose the easier of the two, and let the VIC cipher generate a checkerboard for us:

my_checkerboard = my_cipher.generate_checkerboard()
my_message = "Hello World!"
cipher_text = my_cipher.encrypt(my_message, my_checkerboard)
plain_text = my_cipher.decrypt(cipher_text, my_checkerboard)

The checkerboard, in this example, could be exported and saved for future use.

Cryptanalysis

Supported cryptanalysis tools can be found on our wiki.

Contributing

To help Bletchley's continued development, please consider contributing to the project (you can find our contribution guide here).

Release files for bletchley 0.3.0

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

Source distribution (sdist)

Source distribution for bletchley 0.3.0
File Size Uploaded
bletchley-0.3.0.tar.gz 24.1 kB Details

Release files / bletchley-0.3.0.tar.gz

Download URL bletchley-0.3.0.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
eb002283af4a514c2f354fe72136bec6821ddfb85ee6c4dc75d3a105b1361ff1
BLAKE2b-256 checksum
How to use checksums
3ab82e91134af92a822a5a7184feef67f9795a775771d698c1e2d529807b9fea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.0

1 release file

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