This repository provides an AES-256 encryption tool that supports key generation, encryption, and decryption. Currently, only the ECB (Electronic Codebook) mode is implemented, but the framework is prepared to support other modes as well as GPU acceleration in future updates.
- Key Generation: Automatically generates a 256-bit key for AES encryption using the SHA256 algorithm.
- Encryption: Encrypts plaintext using AES-256 in ECB mode.
- Decryption: Decrypts ciphertext using AES-256 in ECB mode.
- C++17 or later
- Cmake 3.10 or later
mkdir build
cd build
cmake ..
cmake --build .--generate-key/-gGenerates a new encryption key using SHA-256.--encrypt/-ePerforms encryption of a file or folder. Requires the--input-file,--output-path,--key-fileand--key-modeparameters.--decrypt/-dPerforms decryption of a file or folder. Requires the--input-file,--output-path,--key-fileand--key-modeparameters.
--key-path/-p(Optional) Specifies the directory path to save the generated key. Defaults to the current directory.--key-filename/-f(Optional) Specifies the filename for the generated key. If not provided, the default filename is"key".--input-file/-i(Required for encryption/decryption) Specifies the path to the input file or folder to be encrypted or decrypted. This parameter is mandatory for both encryption and decryption modes.--key-file/-k(Required for encryption/decryption) Specifies the path to the key file used for encryption or decryption. This parameter is mandatory for both encryption and decryption modes.--output-path/-o(Required for encryption/decryption) Specifies the directory where the output (encrypted or decrypted) file(s) should be saved. This parameter is mandatory for both encryption and decryption modes.
-
--key-mode/-m(Optional)
Specifies the encryption mode.
Available options:
EBC(default): Electronic Codebook mode.
- Only one operation mode can be selected at a time.
The following are mutually exclusive:
--generate-key--encrypt--decrypt
- When performing encryption or decryption, both
--input-file,--output-path,--key-fileand--key-modeare required. Failing to provide these will result in an error. - When generating a key (
--generate-key), you may optionally specify--key-pathand--key-filenameto control where and how the key is saved.
./aes_tool --generate-key -p /path/to/save/key -f my_key
Generates a new encryption key and saves it to /path/to/save/key/my_key.
./aes_tool --encrypt -i /path/to/input/file -k /path/to/key -o /path/to/output -m ECB
Encrypts the input file using the specified key and saves the output to the provided output path using the ECB mode.
./aes_tool --decrypt -i /path/to/encrypted/file -k /path/to/key -o /path/to/output -m ecb
Decrypts the input file using the specified key and saves the output, using the ECB mode.
At present, the tool only supports ECB mode. More modes like CBC, CFB, OFB, and GCM will be added in future releases.
This program is released as open-source for the purpose of learning and technical exchange. The following sections outline the terms of the open-source license and the related disclaimer.
This program is distributed under the MIT License. You are free to copy, modify, distribute, and use the source code, provided that you retain the original license notice and copyright information.
- Educational Purposes Only This program is provided solely for educational and technical exchange purposes. No security or reliability guarantees are made. The developers make no warranties regarding the accuracy, completeness, performance, or fitness of the program for any particular purpose.
- No Security Guarantees The encryption functionality of this program is intended only for learning purposes and does not guarantee the security of encrypted data. It is not recommended for use in any production environment or scenarios involving sensitive data. Users are solely responsible for any security risks, including data breaches, when using this program.
- Use at Your Own Risk The developers shall not be liable for any damage caused to users' computer files, systems, or other data as a result of using or modifying this program. Users assume full responsibility for all consequences of using this program.
- Modifications and Redistribution Users are permitted to modify and redistribute this program. However, any issues arising from such modifications, including but not limited to data loss, system damage, or information leakage, are the sole responsibility of the user. The developers are not liable for any risks introduced by modified versions of the program.
Notice: By using this program, you acknowledge that you have read and agreed to this disclaimer, and that you understand and accept the responsibilities and risks outlined herein.