This repository demonstrates how to use the Crypto++ (Crypto++) v8.9(Oct 2, 2023 Released) library in simple C++ projects. It includes hashing, AES encryption/decryption.
✅ Tested on Windows 10 / Visual Studio 2019 / CMake 3.31.8
This repository demonstrates how to use the Crypto++ (https://cryptopp.com/) library in simple C++ projects.
It includes hashing, encryption/decryption, digital signatures, and more.
Windows 10+Git for WindowsC++ ISO 17compatible compiler (GCC, Clang, MSVC)- Visual Studio 2019
- CMake ≥ 3.10
- Crypto++ library ≥ 8.0 installed or available
git clone https://github.com/ahnshy/Cryptopp-Demo.git
cd Cryptopp-Demo/ `Root` # Source files with examples
├── TestData/ # Crypto Test Data
├── TestPrograms/ # Crypto Test Programs
├── TestVectors/ # Crypto Test Vectors
├── ...
├── HashExample.cpp
├── SymmetricCipher.cpp
├── AsymmetricExample.cpp
│── DigitalSignature.cpp
└── README.md # You are here
- When using RSA/ECDSA examples, ensure secure key sizes (e.g. RSA‑2048 or ECDSA P‑256).
- Make sure to use
AutoSeededRandomPoolfor cryptographically secure randomness. - Don't handle sensitive data (keys, IVs) in hard-coded strings in production.
Compiled libraries (.lib, .dll, .exe) will be located in:<br/
Win32/cryptest
Win32/cryptlib
Win32/Output
int CRYPTOPP_API main(int argc, char *argv[]) {
UNREFERENCED_PARAMETER(argc);
UNREFERENCED_PARAMETER(argv);
CryptoPP::byte key[CryptoPP::AES::DEFAULT_KEYLENGTH], initVector[CryptoPP::AES::BLOCKSIZE];
memset(key, 0x00, CryptoPP::AES::DEFAULT_KEYLENGTH);
memset(initVector, 0x00, CryptoPP::AES::BLOCKSIZE);
std::string plainText = "PlainText Test 가나다라 with Korean.";
auto ciphertext = AESEncrypt(plainText, key, initVector);
auto decryptedtext = AESDecrypt(plainText, key, initVector);
}
| File | Description |
|---|---|
HashExample.cpp |
SHA‑256, SHA‑1, MD5 hashing demonstrations |
SymmetricCipher.cpp |
AES‑CBC and AES‑GCM encryption/decryption flows |
AsymmetricExample.cpp |
RSA key generation, encryption, decryption |
DigitalSignature.cpp |
Signing and verifying data with RSA/ECDSA |
./HashExample
./SymmetricCipher
./AsymmetricExample
./DigitalSignatureThis demo project is distributed under the MIT License. Crypto++ itself is licensed under Crypto++ License (similar to BSD) — see LICENSE files for details.