"""My digital diary, safely locked away... or is it? If you can break the code, you deserve to read them :D """
This toolkit provides a simple and efficient way to encrypt and decrypt messages using modular exponentiation. The encryption is based on a randomly generated prime modulus and encryption exponent.
-
cipher.h – Core encryption and decryption functions.
-
prime_utils.h – Random prime and encryption exponent generation utilities.
-
main.cpp – Example implementation demonstrating encryption and decryption.
-
A random prime modulus (p) and encryption exponent (e) are generated.
-
The decryption exponent (d) is computed.
-
The input message is encrypted using p and e.
-
The encrypted message is saved to a date-based file.
-
The encrypted message is decrypted using d to verify correctness.
-
Compile the Program
mkdir build && cd build
cmake ..
make
-
Alternatively, compile using g++:
g++ main.cpp -o encryption_tool
-
Run the Program
./encryption_tool
The program reads an input message from input.txt, encrypts it, and saves the encrypted output to a file based on the current date.
-
Create an input.txt file with the message you want to encrypt.
-
Run the program.
-
Note the generated (p, e, d) values for future decryption.
-
Check the saved encrypted file.
-
Verify decryption by checking the output printed on the screen.
-
Support for larger prime numbers.
-
Improved key management.
-
Integration with real-world cryptographic applications.
This project is open-source. Feel free to use and modify it!