Skip to main content

A Playfair cipher implementation in Python

Project description

Playfair Cipher

A simple Python implementation of the Playfair cipher.

Usage

import playfairx

password = "secret"
plainText = "Hello World"

print("Password: ")
print(password)
print()

print("Input text:")
print(plainText)
print()

# Generate Playfair compatible alphabet
generatedAlphabet = playfairx.alphabetFromPassowrd(password)

# Create Playfair Grid
grid = playfairx.generateTable(generatedAlphabet)


encryptedText = playfairx.encryptText(plainText, grid=grid)


print("Encrypted Text:")
print(encryptedText)

print()
print()

# Decrypt Text
print("Decrpyted Text:")
print(playfairx.decryptText(encryptedText, grid))

This produces

Password: 
secret

Input text:
Hello World

Encrypted Text:
iskyiqewfqkc


Decrpyted Text:
helxloworldx

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

playfairx-0.1.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

playfairx-0.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: playfairx-0.1.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for playfairx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e9b986081f7cca3475d17a9848dc6327c9225362d268afd8e7431dc9bfbe8d8
MD5 e51bc1bc5f1c08d7dc42e12bb99ab837
BLAKE2b-256 805c8a0d9dc00d71415c0ad37b06b81cf437c985834981ed0b21ea119bcc01c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: playfairx-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for playfairx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 831209b523691cc379ffa23ca03c27be5cef18941a28cd1dfd44d688c08f53d1
MD5 991cd5c91e369b1ddd16c9172540ffc4
BLAKE2b-256 30ed991727967049965e475739b6359c73b276e4be0d95a1a5081f814b5b084a

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