Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TilelliLab/medina-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

MEDINA — Defense-in-Depth Symmetric Encryption

Multi-layered Encrypted Deterministic Interlocked Nested Architecture

A symmetric encryption construction that combines proven primitives (AES-256, SHA3-256, HKDF) in a novel architecture. Not a new algorithm — a new way of composing existing ones.

Two Pillars

Matryoshka Chains — Sequential nested AES-256-CBC layers. Each layer's key derives from the previous. Enforces sequential execution — no parallelism possible regardless of computational resources.

Blind Souk Routing — Binary path through a SHA3-256 hash graph with zero intermediate feedback. Removes oracle feedback that search algorithms rely on, forcing full-path completion before verification.

Combined: an attacker has no parallelism advantage and minimal search advantage.

Quick Start

pip install -r requirements.txt

Encrypt

from engine.medina import encrypt, decrypt
import os
master_key = os.urandom(32) # 256-bit random key
path_key = "01101001" * 32 # 256-bit binary path
message = b"your secret message"
blob = encrypt(message, master_key, path_key, layers=64)
plaintext = decrypt(blob, master_key, path_key)

Benchmark

python -m engine.benchmark

The Challenge

Two encrypted files. Full source code is public. Can you crack them?

Challenge Layers Path Bits Difficulty
Challenge #1 8 16 Crackable
The Forever File 64 256 Computationally infeasible

Challenge #1 is deliberately weak — designed to be broken. The Forever File uses full-strength MEDINA with 256-bit true random keys. Brute force is computationally infeasible with any known algorithm.

Download the .bin files from website/ or challenge/. Run verify.py to check your answer.

Project Structure

medina/
 engine/
 matryoshka.py # Pillar 1: Sequential nested encryption
 blind_souk.py # Pillar 2: Oracle-free hash maze
 medina.py # Combined MEDINA format (V2: entangled keys + HMAC)
 challenge.py # Challenge file generator
 benchmark.py # Performance benchmarks
 challenge/
 MEDINA_CHALLENGE.bin # Challenge #1 (crackable)
 MEDINA_QUANTUM_CHALLENGE.bin # The Forever File
 verify.py # Verify Challenge #1
 verify_quantum.py # Verify Forever File
 website/ # Static website
 CONCEPT.md # Full algorithm specification
 LICENSE.md # MEDINA Open Audit License (MOAL v1.0)
 requirements.txt

License

MEDINA Open Audit License (MOAL v1.0) — Read it. Attack it. Publish your findings. But don't copy the code or ship it commercially without permission. See LICENSE.md.

Named After

The ancient walled cities of Morocco — where the souks are labyrinths by design, where every alley looks the same to outsiders, and where the only way through is to know the path.

A tribute to Marrakech, the Red City. Founded 1070. Almost a millennium of walls that still stand.

And to Muhammad ibn Musa al-Khwarizmi — the man whose name became the word algorithm.

About

A defense-in-depth encryption architecture that combines two independent mechanisms — sequential key-dependent layers and blind path routing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /