A comprehensive encryption tool supporting multiple algorithms
Project description
加密工具 (CryptoTool)
这是一个基于Python的加密工具,提供了多种加密算法的实现,包括AES对称加密、RSA非对称加密以及混合加密方案。
功能特点
- AES对称加密/解密
- RSA非对称加密/解密
- 混合加密方案(AES + RSA)
- 文件加密/解密支持
- 完整的错误处理和日志记录
安装
- 克隆项目到本地:
git clone https://github.com/yourusername/EncryptionTool.git
cd EncryptionTool
- 创建并激活虚拟环境:
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows
- 安装依赖:
pip install -r requirements.txt
使用方法
基本使用
from cryptool.core.app import CryptoApp
# 初始化加密工具
app = CryptoApp()
# 生成密钥
aes_key = app.generate_aes_key()
rsa_public_key, rsa_private_key = app.generate_rsa_keys()
# 加密/解密示例
text = "Hello, World!"
encrypted_text = app.encrypt(text, aes_key)
decrypted_text = app.decrypt(encrypted_text, aes_key)
文件加密
from cryptool.core.symmetric import AESHandler
# 加密文件
AESHandler.encrypt_file("input.txt", "encrypted.txt", aes_key)
# 解密文件
AESHandler.decrypt_file("encrypted.txt", "decrypted.txt", aes_key)
混合加密
from cryptool.core.hybrid import HybridHandler
# 生成混合加密参数
hybrid_params = app.generate_hybrid_params()
# 加密
encrypted_text = HybridHandler.encrypt(text, hybrid_params)
# 解密
decrypted_text = HybridHandler.decrypt(encrypted_text, hybrid_params)
配置
项目使用.env文件进行配置,主要配置项包括:
AES_KEY_LENGTH: AES密钥长度(默认32字节)RSA_KEY_SIZE: RSA密钥大小(默认2048位)LOG_LEVEL: 日志级别(默认INFO)
示例
查看example.py文件获取更多使用示例。
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file huawuque_cryptool-0.1.0.tar.gz.
File metadata
- Download URL: huawuque_cryptool-0.1.0.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
232c74a6dd140602e4337bb9986a6cee58be9e62b96b78dfe4d81c12b9a535b8
|
|
| MD5 |
56c85dd6761285a50c0db4efe5d60c35
|
|
| BLAKE2b-256 |
3425803c716be272e1c6b25865bf3c433f7a172e0e59e8e9f9ae03974dee25d7
|
File details
Details for the file huawuque_cryptool-0.1.0-py3-none-any.whl.
File metadata
- Download URL: huawuque_cryptool-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d82c2b712e4b4208c0060f2970d2995f3acbfdb3a25566eec2f03559a919e59
|
|
| MD5 |
eee3f9dce6f49222bfc4b94cf7529eef
|
|
| BLAKE2b-256 |
3940558898d77e854e8c434e30d5ccadf274c746014c7c6ec467ea1a5001b1db
|