Skip to content

Repository files navigation

This repository represents ongoing experimental research in lightweight cryptographic optimization and does not claim production-ready cryptographic security guarantees.
# Lightweight S-Box Optimization Framework

## Overview

This repository contains a modular cryptographic optimization framework for the discovery and analysis of lightweight S-boxes using a Memetic Algorithm.

The framework focuses on the generation, evaluation, and optimization of 5x5 S-boxes for lightweight cryptographic applications.

The project combines:

- Evolutionary computation
- Memetic optimization
- Cryptographic property evaluation
- Lightweight security analysis
- Logic complexity evaluation
- Linearly equivalent S-box transformations

The framework was developed as part of research into lightweight cryptography and secure S-box construction.

---

# Repository Structure

```text
project/

├── algorithms/
│   ├── helpers.py
│   ├── fitness.py
│   └── memetic_algorithm.py

├── metrics/
│   ├── differential_metrics.py
│   ├── linear_metrics.py
│   ├── bic_sac.py
│   ├── boomerang_uniformity.py
│   ├── logical_complexity.py
│   ├── utils.py
│   └── vto.py

├── transformations/
│   └── linear_equivalence.py

├── analysis/
│   ├── speed_analysis.py
│   ├── comparison_analysis.py
│   └── invariant_property_analysis.md

├── config/
│   └── settings.py

├── requirements.txt
├── README.md
└── .gitignore

Core Components

algorithms/

Contains the core optimization engine.

memetic_algorithm.py

Implements:

  • population evolution
  • mutation
  • crossover
  • elitism
  • local search
  • memetic improvement
  • optimization orchestration

fitness.py

Implements the weighted fitness evaluation system used to score S-box candidates.

helpers.py

Contains reusable optimization helper functions such as:

  • random S-box generation
  • normalization and scaling functions

metrics/

Contains cryptographic evaluation metrics.

differential_metrics.py

Implements:

  • differential branch number
  • differential probability
  • differential bound
  • single-bit differential analysis

linear_metrics.py

Implements:

  • linear approximation analysis
  • maximal linear bias evaluation

bic_sac.py

Implements:

  • Bit Independence Criterion (BIC)
  • Strict Avalanche Criterion (SAC)

boomerang_uniformity.py

Implements:

  • Boomerang Connectivity Table (BCT)
  • Boomerang Uniformity (BU)

vto.py

Implements:

  • Revisited Transparency Order (VTO)

logical_complexity.py

Implements:

  • Espresso-based logic minimization
  • logical complexity estimation

utils.py

Contains reusable utility functions used across metrics.


transformations/

Contains S-box transformation and equivalence operations.

linear_equivalence.py

Implements:

  • linearly equivalent S-box generation
  • random equivalent transformations
  • canonical S-box generation
  • permutation-XOR equivalence analysis

analysis/

Contains benchmarking, experimentation, and evaluation workflows.

speed_analysis.py

Implements:

  • runtime benchmarking
  • statistical timing analysis
  • metric performance evaluation

comparison_analysis.py

Implements:

  • S-box comparison workflows
  • experimental evaluation pipelines
  • cryptographic property comparison

invariant_property_analysis.md

Documents:

  • invariant cryptographic properties
  • variant cryptographic properties
  • affine-equivalence behaviour
  • optimization-aware property categorization

config/

Contains framework configuration files.

settings.py

Contains:

  • optimization parameters
  • population settings
  • mutation rates
  • cache sizes
  • framework constants
  • external tool paths

Main Features

  • Modular memetic optimization framework
  • Lightweight cryptographic analysis
  • Multi-objective fitness evaluation
  • Configurable optimization parameters
  • Logic complexity estimation using Espresso
  • Reusable transformation engine
  • Support for cryptographic experimentation
  • Structured framework architecture

Cryptographic Properties Evaluated

The framework evaluates several important cryptographic properties:

  • Differential Branch Number
  • Differential Probability
  • Differential Bound
  • Linear Approximation Bound
  • Linear Bias
  • Boomerang Uniformity
  • BIC-SAC
  • Revisited Transparency Order (VTO)
  • Logic Complexity
  • Single-Bit Differential Analysis

Requirements

Python Dependencies

The framework requires:

numpy
sage
matplotlib

Additional standard Python libraries used:

  • functools
  • random
  • math
  • subprocess
  • logging
  • statistics
  • itertools
  • time

External Dependencies

Espresso Logic Minimizer

The framework uses Espresso for logic minimization and logical complexity evaluation.

Example configuration:

ESPRESSO_PATH = "path/to/Espresso.exe"

Configured in:

config/settings.py

Example Execution

Run the Memetic Algorithm

python algorithms/memetic_algorithm.py

Run Speed Analysis

python analysis/speed_analysis.py

Example Output

The framework reports:

  • best discovered S-box
  • fitness score
  • differential metrics
  • linear metrics
  • boomerang uniformity
  • BIC-SAC
  • VTO
  • logical complexity
  • statistical analysis results

Research Context

This framework was developed for research into:

  • lightweight cryptography
  • secure S-box design
  • memetic optimization
  • cryptographic property analysis
  • lightweight security for constrained devices

The framework focuses primarily on 5x5 S-box optimization for lightweight applications.


Future Improvements

Potential future extensions include:

  • GPU acceleration
  • additional cryptographic metrics
  • automated benchmarking
  • machine learning guided optimization
  • larger S-box dimensions
  • visualization pipelines
  • experiment tracking systems
  • statistical reporting modules

Author

Meaad Tori

Research Areas:

  • Lightweight Cryptography
  • S-Box Optimization
  • Memetic Algorithms
  • Cryptographic Engineering
  • Security Optimization Frameworks

This repository represents an active research framework and experimental cryptographic evaluation environment. Some components remain under ongoing refinement and validation.

About

Modular memetic optimization framework for lightweight cryptographic S-box generation and evaluation using Python and SageMath.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages