# andb70/cryptography-cryptanalysis-matlab architecture

> Architecture diagram of the GitHub repository andb70/cryptography-cryptanalysis-matlab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/andb70/cryptography-cryptanalysis-matlab
- Repository: https://github.com/andb70/cryptography-cryptanalysis-matlab

## Overview

##### Project type and purpose
- This is not a client-server or full-stack application. It’s a collection of MATLAB code examples accompanying the book “Cryptography and Cryptanalysis in MATLAB.”
- The purpose is educational: each top-level folder corresponds to a chapter in the book, illustrating algorithms and techniques in cryptography.

##### File structure
- Top-level items:
– Licensed files (.gitattributes, LICENSE.txt, Contributing.md, errata.md)
– Chapters named “Ch2 – MATLAB Cryptography Functions” through “Ch14 – Steganography,” each containing MATLAB scripts.
– Subfolders under chapters group related scripts (e.g., “DES” under Ch9).
- There are no build scripts, no services, no external libraries—just standalone .m files structured by topic.

##### README for additional insights
- Confirms that this is versioned code for the published book.
- No runtime configuration or deployment instructions—usage is manual loading and execution in MATLAB.

a. Main components
– “Chapter Modules” block for each chapter (Ch2 through Ch14)
– Within each chapter block, sub-blocks for algorithm groups (e.g., Classic Cryptography, Hash Functions)
– Utility/Licensing block for repository metadata (LICENSE, Contributing.md)
b. Relationships and interactions
– There is no dynamic runtime interaction; illustrate logical grouping only.
c. Architectural patterns or design principles
– It’s a monolithic, modular code library. Key principle: topic-based modularization.
– You might indicate that each chapter is independent and tested separately.
d. Technologies and frameworks
– MATLAB runtime environment.
– No third-party toolboxes beyond base MATLAB.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Repository Metadata
    subgraph "Repository Metadata"
        GITATTR[".gitattributes"] 
        LICENSE["LICENSE.txt"]
        CONTR["Contributing.md"]
        ERR["errata.md"]
        README["README.md"]
    end

    %% Chapter 2
    subgraph "Ch2 – MATLAB Cryptography Functions"
        C2_1["Listing2-1.m"]
        C2_2["Listing2-2.m"]
    end

    %% Chapter 3
    subgraph "Ch3 – Conversions Used in MATLAB"
        C3_1["Listing3_1.m"]
        C3_2["Listing3_2.m"]
        C3_3["Listing3_3.m"]
        C3_4["Listing3_4.m"]
        C3_5["Listing3_5.m"]
        C3_6["Listing3_6.m"]
    end

    %% Chapter 4
    subgraph "Ch4 – Basic Arithmetic Foundations"
        C4_1["Listing4_1.m"]
        C4_2["Listing4_2.m"]
        C4_3["Listing4_3.m"]
    end

    %% Chapter 5
    subgraph "Ch5 – Number Theory"
        C5_1["Fermat.m"]
        C5_2["Fermat2.m"]
        C5_3["NaivePrimality.m"]
        C5_4["Wilson.m"]
    end

    %% Chapter 6
    subgraph "Ch6 – Classic Cryptography"
        C6_1["caesaralgorithm.m"]
        C6_2["Hill_Encryption.m"]
        C6_3["Shift_Encryption.m"]
        C6_4["Vigenere_Decryption.m"]
        C6_5["Vigenere_Encryption.m"]
    end

    %% Chapter 7
    subgraph "Ch7 – Pseudo-Random Number Generators"
        C7_1["Listing7_1_DirectMethod_BinomialRandomNumberGenerator.m"]
        C7_2["Listing7_2.m"]
        C7_3["Listing7_3.m"]
        C7_4["Listing7_4.m"]
    end

    %% Chapter 8
    subgraph "Ch8 – Hash Functions"
        C8_1["Listing81.m"]
        C8_2["Listing82.m"]
        C8_3["Listing83.m"]
        C8_4["Listing84.m"]
    end

    %% Chapter 9
    subgraph "Ch9 – Block Ciphers: DES and AES"
        C9_1["Listing91.m"]
    end

    %% Chapter 10
    subgraph "Ch10 – Asymmetric Encryption"
        C10_1["ElGamal.m"]
        C10_2["RSA.m"]
    end

    %% Chapter 11
    subgraph "Ch11 – Formal Techniques"
        C11_1["GenerateNumbers.m"]
        C11_2["GenerateNumbersInterval.m"]
    end

    %% Chapter 12
    subgraph "Ch12 – Visual Cryptography"
        C12_1["Shamir.m"]
    end

    %% Chapter 13
    subgraph "Ch13 – Chaos-based Cryptography"
        C13_1["Listing13_1.m"]
        C13_2["Listing13_2.m"]
        C13_3["Listing13_3.m"]
        C13_4["Listing13_4.m"]
        C13_5["Listing13_5.m"]
        C13_6["Listing13_6.m"]
    end

    %% Chapter 14
    subgraph "Ch14 – Steganography"
        C14_1["Listing14_1.m"]
        C14_2["Listing14_2.m"]
    end

    %% Click Events for Metadata
    click GITATTR "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/.gitattributes"
    click LICENSE "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/LICENSE.txt"
    click CONTR "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Contributing.md"
    click ERR "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/errata.md"
    click README "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/README.md"

    %% Click Events for Ch2
    click C2_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch2 - MATLAB Cryptography Functions/Listing2-1.m"
    click C2_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch2 - MATLAB Cryptography Functions/Listing2-2.m"

    %% Click Events for Ch3
    click C3_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch3 - Conversions used in MATLAB/Listing3_1.m"
    click C3_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch3 - Conversions used in MATLAB/Listing3_2.m"
    click C3_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch3 - Conversions used in MATLAB/Listing3_3.m"
    click C3_4 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch3 - Conversions used in MATLAB/Listing3_4.m"
    click C3_5 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch3 - Conversions used in MATLAB/Listing3_5.m"
    click C3_6 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch3 - Conversions used in MATLAB/Listing3_6.m"

    %% Click Events for Ch4
    click C4_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch4 - Basic Arithmetic Foundations/Listing4_1.m"
    click C4_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch4 - Basic Arithmetic Foundations/Listing4_2.m"
    click C4_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch4 - Basic Arithmetic Foundations/Listing4_3.m"

    %% Click Events for Ch5
    click C5_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch5 - Number Theory/Fermat.m"
    click C5_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch5 - Number Theory/Fermat2.m"
    click C5_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch5 - Number Theory/NaivePrimality.m"
    click C5_4 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch5 - Number Theory/Wilson.m"

    %% Click Events for Ch6
    click C6_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch6 - Classic Cryptography/CaesarAlgorithm/caesaralgorithm.m"
    click C6_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch6 - Classic Cryptography/HillAlgorithm/Hill_Encryption.m"
    click C6_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch6 - Classic Cryptography/VigenereAlgorithm/Shift_Encryption.m"
    click C6_4 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch6 - Classic Cryptography/VigenereAlgorithm/Vigenere_Decryption.m"
    click C6_5 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch6 - Classic Cryptography/VigenereAlgorithm/Vigenere_Encryption.m"

    %% Click Events for Ch7
    click C7_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch7 - Pseudo-Random Numbers Generators/Listing7_1_DirectMethod_BinomialRandomNumberGenerator.m"
    click C7_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch7 - Pseudo-Random Numbers Generators/Listing7_2.m"
    click C7_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch7 - Pseudo-Random Numbers Generators/Listing7_3.m"
    click C7_4 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch7 - Pseudo-Random Numbers Generators/Listing7_4.m"

    %% Click Events for Ch8
    click C8_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch8 - Hash Functions/Listing81.m"
    click C8_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch8 - Hash Functions/Listing82.m"
    click C8_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch8 - Hash Functions/Listing83.m"
    click C8_4 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch8 - Hash Functions/Listing84.m"

    %% Click Events for Ch9
    click C9_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch9 - Block Ciphers_ DES and AES/DES/Listing91.m"

    %% Click Events for Ch10
    click C10_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch10 - Asymmetric Encryption/ElGamal.m"
    click C10_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch10 - Asymmetric Encryption/RSA.m"

    %% Click Events for Ch11
    click C11_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch11 - Formal Techniques/GenerateNumbers.m"
    click C11_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch11 - Formal Techniques/GenerateNumbersInterval.m"

    %% Click Events for Ch12
    click C12_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch12 - Visual Cryptography/Shamir.m"

    %% Click Events for Ch13
    click C13_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch13 - Chaos-based Cryptography/Listing13_1.m"
    click C13_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch13 - Chaos-based Cryptography/Listing13_2.m"
    click C13_3 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch13 - Chaos-based Cryptography/Listing13_3.m"
    click C13_4 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch13 - Chaos-based Cryptography/Listing13_4.m"
    click C13_5 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch13 - Chaos-based Cryptography/Listing13_5.m"
    click C13_6 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch13 - Chaos-based Cryptography/Listing13_6.m"

    %% Click Events for Ch14
    click C14_1 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch14 - Steganography/Listing14_1.m"
    click C14_2 "https://github.com/andb70/cryptography-cryptanalysis-matlab/blob/main/Ch14 - Steganography/Listing14_2.m"

    %% Styles
    classDef metadata fill:#f9f,stroke:#333,stroke-width:1px
    classDef script fill:#dfd,stroke:#333,stroke-width:1px
    class GITATTR,LICENSE,CONTR,ERR,README metadata
    class C2_1,C2_2,C3_1,C3_2,C3_3,C3_4,C3_5,C3_6,C4_1,C4_2,C4_3,C5_1,C5_2,C5_3,C5_4,C6_1,C6_2,C6_3,C6_4,C6_5,C7_1,C7_2,C7_3,C7_4,C8_1,C8_2,C8_3,C8_4,C9_1,C10_1,C10_2,C11_1,C11_2,C12_1,C13_1,C13_2,C13_3,C13_4,C13_5,C13_6,C14_1,C14_2 script
```
