Skip to main content

A Genetic Algorithm-based dynamic AES S-box generator

Project description

Dynamic S-Box Generator

dynamic-sbox is a Python package that generates AES S-boxes using a Genetic Algorithm (GA) approach. It evaluates each S-box candidate based on non-linearity and avalanche effect, evolving toward cryptographically secure substitution boxes.


📦 Features

  • Random S-box generation with 256 unique values
  • Fitness evaluation using:
    • Non-linearity (Differential uniformity)
    • Avalanche effect
  • Genetic operations:
    • Crossover
    • Mutation
    • Repair
  • Visualization of final S-box as a 16×16 hexadecimal matrix using pandas
  • Exports the best S-box to a .txt file
  • CLI support: generate-sbox

🔧 Requirements

  • Python 3.6+
  • numpy
  • pandas

🚀 Installation

✅ From Source

pip install dynSboxGA

🔍 Usage

As a Python Module

from dynamic_sbox import DynamicAESSBoxGA, display_sbox_hex_table

sbox_gen = DynamicAESSBoxGA()
best_sbox = sbox_gen.apply_ga()
sbox_gen.export_sbox(best_sbox)
display_sbox_hex_table(best_sbox)

As a CLI Tool

generate-sbox
  • Generates best S-box using GA
  • Saves result to dynamic_sbox.txt
  • Displays 16×16 hex matrix

📄 Output

  • dynamic_sbox.txt: Contains 256 comma-separated integers (final S-box)
  • Visual S-box in terminal (if running in Jupyter or with pandas display support)

🧪 Future Enhancements

  • Add unit tests
  • Support other block sizes or substitution structures
  • Integrate with AES encryption demos

📜 License

MIT License © 2025 Mohammad Luqman, Salman Ali


✨ Author


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

dynsboxga-0.1.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

dynsboxga-0.1.2-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dynsboxga-0.1.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.6

File hashes

Hashes for dynsboxga-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9715198eb746807ff5f69d690aabf620fa57394735f5f8d508766813bdd7484f
MD5 f8b9e3cca59a4f6aa3f2680ebda79441
BLAKE2b-256 1ab6dfb5c217adaa508121bdb7fd039845e3343e20fc9cbc7ccde9040086fdd1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dynsboxga-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.6

File hashes

Hashes for dynsboxga-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5e81bd50867b9007bf810cee83da2b44aead55737242013b0fba9a76415f6f1
MD5 e2961f12a718cae4114a84e46b5cc4ca
BLAKE2b-256 b1a845b5f2839b65d74576716685d8aa107f58720cdbf8aae06eee4108da4ce1

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