Skip to content

AlstonChan/birthday-simulation

Repository files navigation

Birthday Simulation

This is a TUI (Terminal User Interface) application written in C that shows how birthday paradox works, prove how birthday attack can finds collision in less than half of the hash space count.

Application preview

Getting Started

To run, build or develop the application, you should start from here.

Get the executables

You can download the executable from GitHub release.

Library Used

  • OpenSSL - For generating cryptographically random bytes for hashing, which also provides the hash function the program needed like sha256, sha512, etc..
  • ncurses - The core library to build UI in this CLI application
  • GLib - To use their thread pool implementation for calculating hashes concurrently without block the main/UI thread

Prerequisites

  • If you are on Windows, you need to install MSYS2. That should also install UCRT64 for you.
  • Install all library listed in the Library Used section. In windows, you should use the UCRT64 terminal and pacman to search and install the library.
  • Install CMake and make

Build

  1. Clone the repository into your local machine

    git clone https://github.com/AlstonChan/birthday-simulation.git
  2. Install the dependencies package

    • For linux:

      sudo apt update && sudo apt install build-essential libncurses5-dev libncursesw5-dev libsysprof-capture-4-dev libssl-dev libglib2.0-dev libc6-dev libzstd-dev libtinfo-dev gdb valgrind clang-format
    • For Windows:

      Open your MSYS2-UCRT64 command line:

      Update and upgrade all the packages, you MAY need to run this command multiple times until you see the message there is nothing to do.

      pacman -Syu

      Install the toolchain:

      pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain

      then install the packages:

      pacman -S mingw-w64-ucrt-x86_64-glib2 mingw-w64-ucrt-x86_64-ncurses mingw-w64-ucrt-x86_64-openssl
  3. Generate the make file with CMake, for your platform:

    On Windows, using MinGW

    cmake -S . -B build -G "MinGW Makefiles"

    On Linux/Unix, using the standard unix makefile

    cmake -S . -B build -G "Unix Makefiles"
  4. Run make to build the application

    make -C build

Documentations

  1. To build and view the documentations locally, install doxygen

    sudo apt update && sudo apt install doxygen

    or install it from the doxygen website if you have a GUI

  2. Generate the documentation site to docs

    doxygen Doxyfile
  3. View the site

    open ./docs/html/index.html

Resources

About

A simple command-line application demonstrating the surprising likelihood of birthday collisions.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors