cryptanalysis
Automated cryptanalysis of substitution permutation network cipher
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.4%) to scientific vocabulary
Keywords
Repository
Automated cryptanalysis of substitution permutation network cipher
Basic Info
- Host: GitHub
- Owner: deut-erium
- License: agpl-3.0
- Language: Python
- Default Branch: main
- Homepage: https://deut-erium.github.io/auto-cryptanalysis
- Size: 120 KB
Statistics
- Stars: 32
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
Auto Cryptanalysis
This project implements python module for automatic cryptanalysis of Substitution Permutation Network ciphers by performing extensive linear and differential characteristic search and finding keybits
Structure
The project is structured as follows:
- The
cryptanalysisdirectory contains the main Python module for cryptanalysis. - The
testsdirectory contains unit tests for the module - The
examplesdirectory contains examples for using the module - The
docsdirectory contains html documentation autogenerated from code doc-strings
Installation
Pip
The project can be installed directly from pip
bash
pip install cryptanalysis
Otherwise clone and install is also viable
bash
git clone https://github.com/deut-erium/auto-cryptanalysis.git
cd auto-cryptanalysis
pip install .
Requirements
This project requires Python3.6+ and the following Python packages: - z3-solver - tqdm
Requirements are auto installed as a part of the installation process but
You can also install these packages using pip:
bash
pip install -r requirements.txt
Usage
```python import random import cryptanalysis
sboxsize = 6 # bits pboxsize = sboxsize * 16 # 16 sboxes numrounds = 4 sbox = list(range(2**sboxsize)) pbox = list(range(pboxsize))
random pbox and sbox
random.shuffle(sbox) random.shuffle(pbox)
randomkey = random.randint(0, (2**pboxsize) - 1)
random spn instance whose key is unknown to us
spn = cryptanalysis.SPN(sbox, pbox, randomkey, numrounds)
dc = cryptanalysis.differentialcryptanalysis.DifferentialCryptanalysis(sbox, pbox, num_rounds+1)
override batch_encrypt with the oracle
maxnumencryptions = 50000 def batch_encrypt(plaintexts): return [spn.encrypt(i) for i in plaintexts]
dc.batchencrypt = batchencrypt differentialcharacteristics = dc.characteristicsearcher.searchexclusivemasks() lastroundkeyblocks = dc.findlastroundkey(differentialcharacteristics, maxnum_encryptions//16)
print("recovered last round key:",lastroundkeyblocks) print("original last round key:",dc.inttolist(spn.round_keys[-1])) ```
Tests
You can run the tests using the following command:
bash
python -m unittest discover
Documentation
Read the documentation
Autogenerated documentation from code doc-strings can be found under docs
Contributing
Please feel free to submit pull requests or create issues if you find any bugs or have any suggestions for improvements.
List of ideas to implement/TODO is present in CONTRIBUTING.md
License
This project is licensed under the GPL License.
Owner
- Name: Himanshu Sheoran
- Login: deut-erium
- Kind: user
- Location: India
- Company: @vmware
- Website: https://deut-erium.github.io/
- Repositories: 27
- Profile: https://github.com/deut-erium
Spreading nerdona virus since ever. Participates actively in CTFs and finds crypto, rev, pwn interesting. Intrigued? hmu with your best python one-liner
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: auto-cryptanalysis
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Himanshu Sheoran
identifiers:
- type: url
value: 'https://github.com/deut-erium/auto-cryptanalysis'
description: Github
repository-code: 'https://github.com/deut-erium/auto-cryptanalysis'
url: 'https://deut-erium.github.io/auto-cryptanalysis/'
abstract: >-
A tool for automated cryptanalysis of Substitution-Permutation Network (SPN) ciphers
is presented. The tool identifies optimal characteristic paths on SPNs to perform
linear and differential cryptanalysis. It employs advanced Satisfiability Modulo Theories
(SMT) analysis using the z3 solver to examine combinations of Substitution Boxes (SBOX)
and Permutation Boxes (PBOX). This enables efficient exploration of large state spaces, enhancing
the tool's ability to uncover hidden vulnerabilities in SPN-based cryptographic schemes.
keywords:
- SMT
- Z3
- SPN
- Block cipher
license: GPL
commit: >-
https://github.com/deut-erium/auto-cryptanalysis/commit/fde6065eeeed2ffd6521b1fcaf67202ab3843752
GitHub Events
Total
- Watch event: 6
Last Year
- Watch event: 6
Packages
- Total packages: 1
-
Total downloads:
- pypi 94 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 3
- Total maintainers: 1
pypi.org: cryptanalysis
Automated cryptanalysis library for substitution permutation network
- Homepage: https://github.com/deut-erium/auto-cryptanalysis
- Documentation: https://deut-erium.github.io/auto-cryptanalysis
- License: GPL
-
Latest release: 0.0.3
published over 2 years ago