🏳️
The CTF Recipes
  • Introduction
  • Cryptography
    • Introduction
    • General knowledge
      • Encoding
        • Character encoding
          • ASCII
          • Unicode
          • UTF-8
        • Data encoding
          • Base16
          • Base32
          • Base64
      • Maths
        • Modular arithmetic
          • Greatest Common Divisor
          • Fermat's little theorem
          • Quadratic residues
          • Tonelli-Shanks
          • Chinese Remainder Theorem
          • Modular binomial
      • Padding
        • PKCS#7
    • Misc
      • XOR
    • Mono-alphabetic substitution
      • Index of coincidence
      • frequency analysis
      • Well known algorithms
        • πŸ”΄Scytale
        • πŸ”΄ROT
        • πŸ”΄Polybe
        • πŸ”΄Vigenere
        • πŸ”΄Pigpen cipher
        • πŸ”΄Affine cipher
    • Symmetric Cryptography
      • AES
        • Block Encryption procedure
          • Byte Substitution
          • Shift Row
          • Mix Column
          • Add Key
          • Key Expansion / Key Schedule
        • Mode of Operation
          • ECB
            • Block shuffling
              • Challenge example
            • ECB Oracle
              • Challenge example
          • CBC
            • Bit flipping
              • Challenge example
            • Padding oracle
              • Challenge example
          • OFB
            • Key stream reconstruction
            • Encrypt to Uncrypt
  • πŸ› οΈPwn
    • General knowledge
      • STACK
        • Variables storage
        • Stack frame
      • PLT and GOT
      • HEAP
        • HEAP operations
        • Chunk
        • Bins
        • Chunk allocation and reallocation
      • Syscall
    • Architectures
      • aarch32
        • Registers
        • Instruction set
        • Calling convention
      • aarch64
        • Registers
        • Instruction set
        • Calling convention
      • mips32
        • Registers
        • Instruction set
        • Calling convention
      • mips64
        • Registers
        • Instruction set
        • Calling convention
      • x86 / x64
        • Registers
        • Instruction set
        • Calling convention
    • Stack exploitation
      • Stack Buffer Overflow
        • Dangerous functions
          • gets
          • memcpy
          • sprintf
          • strcat
          • strcpy
        • Basics
          • Challenge example
        • Instruction pointer Overwrite
          • Challenge example
        • De Bruijn Sequences
        • Stack reading
          • Challenge example
      • Format string
        • Dangerous functions
          • printf
          • fprintf
        • Placeholder
        • Data Leak
          • Challenge example
        • Data modification
          • Challenge example
      • Arbitrary code execution
        • Shellcode
        • ret2reg
        • Code reuse attack
          • Ret2plt
          • Ret2dlresolve
          • GOT Overwrite
          • Ret2LibC
          • Leaking LibC
          • Ret2csu
          • Return Oriented Programming - ROP
          • Sigreturn Oriented Programming - SROP
          • Blind Return Oriented Programming - BROP
            • Challenge example
          • πŸ”΄Call Oriented Programming - COP
          • πŸ”΄Jump Oriented Programming - JOP
          • One gadget
        • Stack pivoting
    • πŸ› οΈHeap exploitation
      • Heap overflow
        • Challenge example
      • Use after free
        • Challenge example
      • πŸ› οΈDouble free
      • πŸ”΄Unlink exploit
    • Protections
      • Stack Canaries
      • No eXecute
      • PIE
      • ASLR
      • RELRO
    • Integer overflow
Powered by GitBook
On this page
  • How it works ?
  • Index of coincidence Table
  • Resources
  1. Cryptography
  2. Mono-alphabetic substitution

Index of coincidence

PreviousMono-alphabetic substitutionNextfrequency analysis

Last updated 2 years ago

The Index of Coincidence (IOC) is a statistical measure used in cryptography to analyze the randomness of a set of symbols.

A higher IOC value indicates a less random distribution of letters in the text and can be an indicator that a substitution cipher has been used. By comparing the IOC of a ciphertext to the expected IOC of plaintext in the same language, an attacker can make inferences about the encryption method used and use this information to break the cipher.

How it works ?

To calculate an index of coincidence for a mono-alphabetic substitution, here is the equation :

IC=βˆ‘q=Aq=Znq(nqβˆ’1)n(nβˆ’1)IC = \sum_{q=A}^{q=Z} \frac{n_q(n_q-1)}{n(n-1)}IC=q=Aβˆ‘q=Z​n(nβˆ’1)nq​(nqβ€‹βˆ’1)​

n is a total amount of letters within the text

n_A is the amount of A

n_B is the amount of B etc.

Note: This techniques only works if the provided text is large enough.

Index of coincidence Table

Here is the "standard" indexes of coincidence for theses languages :

Language
Index of coincidence

English

0,0667

Serbian

0,0643

Swedish

0,0644

Esperanto

0,0690

Greek

0,0691

NorvΓ©gien

0,0694

Norwegian

0,0707

Finnish

0,0737

Italian

0,0738

Portuguese

0,0745

Arab

0,0758

German

0,0762

Hebrew

0,0768

Spanish

0,0770

Japanese

0,0772

French

0,0778

Dutch

0,0798

malaysian

0,0852

Russian

0,0529

Resources

https://www.dcode.fr/index-coincidencewww.dcode.fr
CyberChef
Logo