
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
cipherflow
Advanced tools
纯 Python 对称加密库,零第三方依赖。
从零实现 AES(128/192/256)、DES、3DES 算法,支持 ECB / CBC / CFB / OFB / CTR 五种分组模式。
pip install cipherflow
import cipherflow as cf
# 生成密钥,加密
key = cf.generate_key("AES", 256)
ciphertext, iv = cf.encrypt("Hello World", key)
# 解密
plaintext = cf.decrypt(ciphertext, key, iv=iv)
print(plaintext.decode()) # Hello World
| 算法 | 密钥长度 |
|---|---|
| AES | 128 / 192 / 256 bit |
| DES | 64 bit |
| 3DES | 128 / 192 bit |
| 模式 | 需要 IV | 需要填充 |
|---|---|---|
| ECB | 否 | 是 |
| CBC | 是 | 是 |
| CFB | 是 | 否 |
| OFB | 是 | 否 |
| CTR | 是 | 否 |
# 通用加密 / 解密
cf.encrypt(plaintext, key, algorithm="AES", mode="CBC", iv=None) -> (ciphertext, iv)
cf.decrypt(ciphertext, key, algorithm="AES", mode="CBC", iv=None) -> plaintext
# 算法快捷函数
cf.aes_encrypt(plaintext, key, mode="CBC", iv=None)
cf.aes_decrypt(ciphertext, key, mode="CBC", iv=None)
cf.des_encrypt(plaintext, key, mode="CBC", iv=None)
cf.des_decrypt(ciphertext, key, mode="CBC", iv=None)
cf.triple_des_encrypt(plaintext, key, mode="CBC", iv=None)
cf.triple_des_decrypt(ciphertext, key, mode="CBC", iv=None)
# 生成随机密钥 / IV
cf.generate_key(algorithm="AES", bits=256) -> bytes
cf.generate_iv(algorithm="AES") -> bytes
# 打包(IV + 密文合并传输)
cf.pack(ciphertext, iv) -> bytes
cf.unpack(data) -> (ciphertext, iv)
import cipherflow as cf
msg = "机密数据"
# AES-128-CTR
key = cf.generate_key("AES", 128)
ct, iv = cf.encrypt(msg, key, mode="CTR")
print(cf.decrypt(ct, key, mode="CTR", iv=iv).decode())
# DES-CBC
key = cf.generate_key("DES")
ct, iv = cf.des_encrypt(msg, key)
print(cf.des_decrypt(ct, key, iv=iv).decode())
# 3DES-ECB
key = cf.generate_key("3DES", 192)
ct, iv = cf.triple_des_encrypt(msg, key, mode="ECB")
print(cf.triple_des_decrypt(ct, key, mode="ECB").decode())
# pack / unpack 便于网络传输
ct, iv = cf.aes_encrypt(msg, cf.generate_key())
packed = cf.pack(ct, iv)
ct2, iv2 = cf.unpack(packed)
MIT
FAQs
纯 Python 对称加密库,零依赖。支持 AES/DES/3DES,ECB/CBC/CFB/OFB/CTR 模式。
The pypi package cipherflow receives a total of 558 weekly downloads. As such, cipherflow popularity was classified as not popular.
We found that cipherflow demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.