corecipher
加解密工具基础包。提供AES/RSA等加解密方式。
安装
pip install corecipher
加密过程
- 使用
data_encoder(内容编解码器)对原始数据进行编码,得到bytes类型的原始数据。- 默认使用
Utf8DataEncoder编解码器。 - 要求原始数据为可以utf8编码的字符串类型。
- 默认使用
- 对
bytes类型的原始数据进行加密,得到bytes类型的加密结果。 - 对
bytes类型的加密结果,使用result_encoder(结果编解码器)进行编码,得到最终的结果。- 默认使用
Base64ResultEncoder编解码器。 - 最终结果一般为
str类型。
- 默认使用
解密过程
- 使用
result_encoder进行解码。 - 进行解密操作。
- 使用
data_encoder进行解码。
支持的内容编解码器
- RawDataEncoder
- Utf8DataEncoder
- Gb18030DataEncoder
- JsonEncoder
- PickleEncoder
- MarshalEncoder
- MsgPackEncoder
支持的结果编解码器
- RawResultEncoder
- Utf8ResultEncoder
- Base64ResultEncoder
- URLSafeBase64ResultEncoder
- HexlifyResultEncoder
支持的加解密方式
AES加解密
- GCMAESCipher
- CTRAESCipher
- ECBAESCipher
- MysqlCompatibleAESCipher
RSA加解密
- RSACipher
RSA+AES加解密
- RESCipher
密码表加解密
- M1Cipher
- M2Cipher
- M12Cipher
- S1Cipher
- S12Cipher
- IvCipher
- IvfCipher
使用方法
AES GCM模式加解密
import corecipher
gen = corecipher.GCMAESCipher(password="hello")
data1 = "hello"
data2 = gen.encrypt(data1)
data3 = gen.decrypt(data2)
assert data1 == data3
AES CTR模式加解密
import corecipher
gen = corecipher.CTRAESCipher(password="hello")
data1 = "hello"
data2 = gen.encrypt(data1)
data3 = gen.decrypt(data2)
assert data1 == data3
AES ECB模式加解密
import corecipher
gen = corecipher.ECBAESCipher(password="hello")
data1 = "hello"
data2 = gen.encrypt(data1)
data3 = gen.decrypt(data2)
assert data1 == data3
版本记录
v0.1.0
- 版本首发。
- 添加RSA/AES加解密支持。
Metadata
Release files for corecipher 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| corecipher-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for corecipher-0.1.0-py3-none-any.whl |
Release files / corecipher-0.1.0-py3-none-any.whl
| Download URL | corecipher-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7bc961da6d968fe00487506bf942b89813ff517e42ada795158c76b443fda7f
|
|
BLAKE2b-256 checksum How to use checksums |
ecd49d3e1ad1c5434bf37ba4c30d651b32784a7482d13eae24ecc5604177d86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Security for corecipher 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.