Hybrid Cache

Welcome to the Hybrid Cache Implementation Repository! This repository contains the implementation of Kyber and Dilithium cryptographic algorithms, as well as AES, Keccak, and NTT-related kernels manually compiled to the instructions for Hybrid Cache. Please follow the instructions and guidelines mentioned below to ensure a smooth review process.

Table of Contents

  1. Repository Structure
  2. Setup and Installation
  3. Running the Program
  4. License
  5. Acknowledgements

1. Repository Structure

The repository is organized as follows:

  • algorithms/: Contains the Kyber and Dilithium cryptographic algorithm implementations
    • kyber/: Contains the Kyber algorithm implementation
    • dilithium/: Contains the Dilithium algorithm implementation
  • kernels/: Contains the kernel implementations for AES, Keccak, and NTT-related operations
    • AES/: Contains the AES kernel implementations with different configurations
    • keccak/: Contains the Keccak kernel implementations
    • NTT/: Contains the NTT-related kernel implementations, such as Montgomery multiplication and NTT

2. Setup

Before running the program, ensure that you have the following prerequisites installed on your system:

  • A C compiler
  • A C++ compiler
  • CMake (version 3.10 or later)

To run the project, follow these steps:

  1. Clone the repository to your local machine:
git clone https://github.com/Ssicayoon/hybrid-cache.git

3. Running the Program

After cloning the repository, follow these steps to run the program:

  1. Navigate to the root directory of the repository:
cd hybrid-cache
  1. Navigate to the folder you want to run. Algorithms and kernels have two different flow of execution.

    1. To run the algorithms (e.g., Kyber, Dilithium), navigate to the algorithms/kyber/ref or algorithms/dilithium/ref folder:
    # For other configurations, replace "kyber512" with "kyber768" or "kyber1024"
    cd algorithms/kyber/ref
    make test_kyber512
    ./test_kyber512
    
    # For other configurations, replace "dilithium2" with "dilithium3" or "dilithium5" or "dilithium2aes" or "dilithium3aes" or "dilithium5aes"
    cd algorithms/dilithium/ref
    make test/test_dilithium2
    ./test/test_dilithium2
    
    • The terminal shows the number of instructions and cycles with instructions stored in output.txt.
    1. To run the kernels (e.g., AES), navigate to the kernels/AES folder:
    cd kernels/AES/AES128_ECB
    cc aes.c aes_test.c -o aes
    ./aes
    
    • The terminal shows the number of instructions and cycles with instructions stored in output.txt.
  2. Sample outputs of Kyber and Dilithium can be found in algorithms/kyber/outputs and algorithms/dilithium/outputs, respectively. We provide the sample instruction output of Kyber512 in algorithms/kyber/outputs/test_kyber512_instructions.txt. The sample outputs of kernels can be found in their respective folders.

4. License

This repository is licensed under the Apache License 2.0. Please see the LICENSE file for more details.

5. Acknowledgements

This repository is based on the following repositories: