asterisk-security
介绍
这个小项目最初是几年前写Django的项目,想在后端写个cookie的加密功能,后来就自己动手写了一个可以加密的函数。主要是个人工作的积累而已。随着后续开发的需求,将不断将更多的个人经验总结道这个开源项目。
项目交流与缺陷提交这里
注意:
- 发行版本的版本号不一定连续,中间的版本号都是开发中的版本号,不正式发布。
- 版本号为A.B.C.mmdd.hhmm的格式,只须关注A.B.C即可,mmdd.hhmm为build时间戳
软件架构
/
|-- asterisksecurity/
| |-- encryption.py
| | |-- AsteriskEncrypt
| |
| |-- error.py
| | |-- InvalidEncriptionKey
安装教程
pip install asterisk-security
使用说明
安装后在python代码中引入,实例化后调用
- 需要以key来实例化
AsteriskEncrypt类 encrypt方法可以将传参字符串进行加密并返回字符串decrypt方法将已加密的字符串进行解密
例子:
from asterisksecurity.encryption import AsteriskEncrypt
def test_encrypt():
key = 'X7UJi2VdqcQlc3thv2dDPEn5y3yv3eTk35yyAhlKeAY1'
a = AsteriskEncrypt(key)
s = '你好世界!Hello World!'
s_enc = a.encrypt(s)
print(s_enc)
a_dec = a.decrypt(s_enc)
print(a_dec)
if __name__ == '__main__':
test_encrypt()
直接使用命令行
- 使用asencrypt命令
usage: asencrypt [-h] [-key K] [-txt T]
asterisk-security加密工具
options:
-h, --help show this help message and exit
-key K 加密密钥,长度不能超过22个字符,否则,进行左右11个字符截取,格式:[a-zA-Z0-9]+,不得包含特殊字符 encrypt key, length should not exceed 22 characters, otherwise, left and
right 11 characters will be intercepted, format: [a-zA-Z0-9]+, no special characters allowed
-txt T 需要加密的字符串 string to be encrypted```markdown
- 使用asdecrypt命令
usage: asdecrypt [-h] [-key K] [-txt T]
asterisk-security解密工具
options:
-h, --help show this help message and exit
-key K 解密密钥,长度不能超过22个字符,否则,进行左右11个字符截取,格式:[a-zA-Z0-9]+,不得包含特殊字符 decrypt key, length should not exceed 22 characters, otherwise, left and
right 11 characters will be intercepted, format: [a-zA-Z0-9]+, no special characters allowed
-txt T 需要解密的字符串 string to be decrypted
错误说明
- key字符串如果不符合格式要求,会抛出error
- 其他在解密过程中有任何error都不做处理。
参与贡献
- Fork 本仓库
- 新建 Feat_xxx 分支
- 提交代码
- 新建 Pull Request
Metadata
Release files for asterisk-security 0.1.5.224.1713
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asterisk_security-0.1.5.224.1713.tar.gz | 11.2 kB | Without provenance | Details for asterisk_security-0.1.5.224.1713.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asterisk_security-0.1.5.224.1713-py3-none-any.whl | Python 3 | none | any | Details for asterisk_security-0.1.5.224.1713-py3-none-any.whl |
Total release size: 22.4 kB
Release files / asterisk_security-0.1.5.224.1713.tar.gz
| Download URL | asterisk_security-0.1.5.224.1713.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e274b705fc0acaeab1dd5e726adcaa2ada7efe471e13ba7e2d2278935a592a15
|
|
BLAKE2b-256 checksum How to use checksums |
6020cf4b6b1db984392cf3aecc5f24c69731fb42e1c8f48219e2cd3117075175
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / asterisk_security-0.1.5.224.1713-py3-none-any.whl
| Download URL | asterisk_security-0.1.5.224.1713-py3-none-any.whl |
|---|---|
| Size | 11.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89caee81b29fff8d2ffabd9b5adf13dc991c42dec319e7294809f0d8f5e1e8df
|
|
BLAKE2b-256 checksum How to use checksums |
a4d46b982e968f29232290b61fa1f0b7b7ef49b671a7c3125e0a0e3008019ca0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for asterisk-security 0.1.5.224.1713
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.