Name | liuzhCrypto JSON |
Version |
5.9.4
JSON |
| download |
home_page | |
Summary | my crypto python package in 2023 |
upload_time | 2023-05-26 09:43:39 |
maintainer | |
docs_url | None |
author | Liuzhenghao |
requires_python | |
license | Apache 2.0 |
keywords |
crypto
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# myCrypto Python 库
## 项目介绍
+ ### 性质:本项目是BUAA-网络空间安全学院-2023年春季密码学实验课程大作业
+ ### 作者:BUAA-网络空间安全学院2021级-21371445-刘征昊
+ ### 概述:本项目采用面向对象编程的方式对本学期实验代码进行整合以及完善,制作了个人的密码学库
## 项目目录结构
```bash
liuzhCrypto
├── README.md
├── __init__.py
├── basicMath # 基础数学库
│ ├── __init__.py
│ ├── ECC.py
│ ├── GF.py
│ ├── basic.py
│ └── type.py
├── blockCipher # 分组密码学库
│ ├── __init__.py
│ ├── SM4.py
├── pubkeyCipher # 公钥密码学库
│ └── __init__.py
│ ├── RSA.py
│ ├── SM2.py
├── hash # 哈希算法库
│ ├── __init__.py
│ ├── SM3.py
├── digitalSignature # 数字签名算法库
│ └── __init__.py
│ ├── SM2_SV.py
├── liuzhCrypto.egg-info
├── dist
│ └── liuzhCrypto-5.9.4.tar.gz
├── testSample # mycrypto完整版测试样例
│ └── testSample.py
└── setup.py
```
## 项目功能:
+ ### [基础数学库](./basicMath):
+ #### [密码学数学运算](./basicMath/basic.py)
+ ##### 支持欧拉算法、模逆运算、快速(模)幂(矩阵)运算、素数生成与检验和中国剩余定理等一系列密码学基础数学运算
+ #### [椭圆曲线上的数学运算](./basicMath/ECC.py)
+ ##### 支持椭圆曲线密码学所需的常见数学运算,如:椭圆曲线上的点的加减法和倍点运算,其中倍点运算支持double-and-add、NAF以及w-NAF三种方法
+ #### [有限域$GF(2^8)$上的数学运算](./basicMath/GF.py)
+ ##### 支持有限域$GF(2^8)$上的常见数学运算,如:四则运算、逆元、矩阵运算等
+ #### [本密码学库涉及到的类型转换等操作](./basicMath/type.py)
+ ##### 自定义了一系列本项目其他文件所需的变量类型
+ ##### 支持十六进制、字节串、字符串、整数、椭圆曲线上的点等变量类型之间的相互转化
+ ### [对称密码学/分组密码学库](./blockCipher)
+ #### [SM4分组密码](./blockCipher/SM4.py)
+ ##### SM4支持分组长度128比特,密钥长度128比特的分组密码加解密运算
+ ##### 支持SM4的ECB和CBC的分组密码工作模式
+ ##### 支持基于ECB或CBC工作模式的对文件的加解密处理
+ ### [非对称密码学/公钥密码学库](./pubkeyCipher)
+ #### [RSA公钥密码](./pubkeyCipher/RSA.py)
+ ##### 支持RSA密钥参数的生成
+ ##### 支持RSA的加解密运算
+ #### [SM2椭圆曲线公钥密码:公钥加密算法](./pubkeyCipher/SM2.py)
+ ##### 支持杂凑函数为SM3(可替换)的SM2公钥加密算法
+ ### [哈希算法/杂凑函数库](./hash)
+ #### [SM3密码杂凑算法](./hash/SM3.py)
+ ##### 支持输出长度为256比特的消息摘要,消息摘要的输出类型包括十六进制字符串以及字节串两种类型
+ ##### 支持对文件的消息摘要生成
+ ### [数字签名算法](./digitalSignature)
+ #### [SM2椭圆曲线公钥密码:数字签名算法](./digitalSignature/SM2_SV.py)
+ ##### 支持基于椭圆曲线的数字签名算法SM2
## 项目特色:
+ ### 面向对象的编程方式
<!--当然作为初学者,本项目只是基本完成了面向对象的思想,与真正完整的面向对象编程仍然有很大的差距,假期会继续学习,加深对面向对象编程的理解和掌握-->
+ ### 编写大量注释,便于使用与理解
+ ### 支持算法错误检查:密钥长度检查、算法内部错误处理等
+ ### 对函数接口变量进行了类型指定, 支持输入类型检查
+ ### 使用setup.py对项目文件进行了[打包](./dist/myCrypto-5.9.4.tar.gz)
## 项目样例:
### 源码详见[完整版测试样例](./testSample/testSample.py)
#### <!--在主程序部分可以根据测试者的需求,添加或减少注释代码进行部分测试-->
```python
if __name__ == "__main__":
"""
可以根据测试需求进行代码注释部分的添加与解除
"""
"""
basicMath测试样例
"""
basic_test()
type_test()
ECC_test()
GF_test()
"""
blockCipher测试样例
"""
SM4_test()
"""
pubkeyCipher测试样例
"""
RSA_test()
SM2_test()
"""
hash测试样例
"""
SM3_test()
"""
digitalSignature测试样例
"""
SM2_SV_text()
```
<!--本项目的工作量主要来自于文档的编写、代码的整合、函数接口的改变、错误处理、测试样例、以及注释等-->
Raw data
{
"_id": null,
"home_page": "",
"name": "liuzhCrypto",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "crypto",
"author": "Liuzhenghao",
"author_email": "liuzh594@qq.com",
"download_url": "https://files.pythonhosted.org/packages/83/ee/198be505707a0b4c7014f25deeab7dd2a22084a4e840d967f3fc137f2576/liuzhCrypto-5.9.4.tar.gz",
"platform": null,
"description": "# myCrypto Python \u5e93\n\n\n\n## \u9879\u76ee\u4ecb\u7ecd\n\n+ ### \u6027\u8d28\uff1a\u672c\u9879\u76ee\u662fBUAA-\u7f51\u7edc\u7a7a\u95f4\u5b89\u5168\u5b66\u9662-2023\u5e74\u6625\u5b63\u5bc6\u7801\u5b66\u5b9e\u9a8c\u8bfe\u7a0b\u5927\u4f5c\u4e1a\n\n+ ### \u4f5c\u8005\uff1aBUAA-\u7f51\u7edc\u7a7a\u95f4\u5b89\u5168\u5b66\u96622021\u7ea7-21371445-\u5218\u5f81\u660a\n\n+ ### \u6982\u8ff0\uff1a\u672c\u9879\u76ee\u91c7\u7528\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u7684\u65b9\u5f0f\u5bf9\u672c\u5b66\u671f\u5b9e\u9a8c\u4ee3\u7801\u8fdb\u884c\u6574\u5408\u4ee5\u53ca\u5b8c\u5584\uff0c\u5236\u4f5c\u4e86\u4e2a\u4eba\u7684\u5bc6\u7801\u5b66\u5e93\n\n\n\n## \u9879\u76ee\u76ee\u5f55\u7ed3\u6784\n\n```bash\nliuzhCrypto\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 __init__.py\n\u251c\u2500\u2500 basicMath # \u57fa\u7840\u6570\u5b66\u5e93\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 ECC.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 GF.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 basic.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 type.py\n\u251c\u2500\u2500 blockCipher # \u5206\u7ec4\u5bc6\u7801\u5b66\u5e93\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 SM4.py\n\u251c\u2500\u2500 pubkeyCipher # \u516c\u94a5\u5bc6\u7801\u5b66\u5e93\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 RSA.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 SM2.py\n\u251c\u2500\u2500 hash # \u54c8\u5e0c\u7b97\u6cd5\u5e93\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 SM3.py\n\u251c\u2500\u2500 digitalSignature # \u6570\u5b57\u7b7e\u540d\u7b97\u6cd5\u5e93\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 SM2_SV.py\n\u251c\u2500\u2500 liuzhCrypto.egg-info\n\u251c\u2500\u2500 dist\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 liuzhCrypto-5.9.4.tar.gz\n\u251c\u2500\u2500 testSample # mycrypto\u5b8c\u6574\u7248\u6d4b\u8bd5\u6837\u4f8b\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 testSample.py \n\u2514\u2500\u2500 setup.py\n```\n\n\n\n## \u9879\u76ee\u529f\u80fd:\n\n+ ### [\u57fa\u7840\u6570\u5b66\u5e93](./basicMath):\n\n + #### [\u5bc6\u7801\u5b66\u6570\u5b66\u8fd0\u7b97](./basicMath/basic.py)\n\n + ##### \u652f\u6301\u6b27\u62c9\u7b97\u6cd5\u3001\u6a21\u9006\u8fd0\u7b97\u3001\u5feb\u901f\uff08\u6a21\uff09\u5e42\uff08\u77e9\u9635\uff09\u8fd0\u7b97\u3001\u7d20\u6570\u751f\u6210\u4e0e\u68c0\u9a8c\u548c\u4e2d\u56fd\u5269\u4f59\u5b9a\u7406\u7b49\u4e00\u7cfb\u5217\u5bc6\u7801\u5b66\u57fa\u7840\u6570\u5b66\u8fd0\u7b97\n\n + #### [\u692d\u5706\u66f2\u7ebf\u4e0a\u7684\u6570\u5b66\u8fd0\u7b97](./basicMath/ECC.py)\n\n + ##### \u652f\u6301\u692d\u5706\u66f2\u7ebf\u5bc6\u7801\u5b66\u6240\u9700\u7684\u5e38\u89c1\u6570\u5b66\u8fd0\u7b97\uff0c\u5982\uff1a\u692d\u5706\u66f2\u7ebf\u4e0a\u7684\u70b9\u7684\u52a0\u51cf\u6cd5\u548c\u500d\u70b9\u8fd0\u7b97\uff0c\u5176\u4e2d\u500d\u70b9\u8fd0\u7b97\u652f\u6301double-and-add\u3001NAF\u4ee5\u53caw-NAF\u4e09\u79cd\u65b9\u6cd5\n\n + #### [\u6709\u9650\u57df$GF(2^8)$\u4e0a\u7684\u6570\u5b66\u8fd0\u7b97](./basicMath/GF.py)\n\n + ##### \u652f\u6301\u6709\u9650\u57df$GF(2^8)$\u4e0a\u7684\u5e38\u89c1\u6570\u5b66\u8fd0\u7b97\uff0c\u5982\uff1a\u56db\u5219\u8fd0\u7b97\u3001\u9006\u5143\u3001\u77e9\u9635\u8fd0\u7b97\u7b49\n\n + #### [\u672c\u5bc6\u7801\u5b66\u5e93\u6d89\u53ca\u5230\u7684\u7c7b\u578b\u8f6c\u6362\u7b49\u64cd\u4f5c](./basicMath/type.py)\n\n + ##### \u81ea\u5b9a\u4e49\u4e86\u4e00\u7cfb\u5217\u672c\u9879\u76ee\u5176\u4ed6\u6587\u4ef6\u6240\u9700\u7684\u53d8\u91cf\u7c7b\u578b\n\n + ##### \u652f\u6301\u5341\u516d\u8fdb\u5236\u3001\u5b57\u8282\u4e32\u3001\u5b57\u7b26\u4e32\u3001\u6574\u6570\u3001\u692d\u5706\u66f2\u7ebf\u4e0a\u7684\u70b9\u7b49\u53d8\u91cf\u7c7b\u578b\u4e4b\u95f4\u7684\u76f8\u4e92\u8f6c\u5316\n\n+ ### [\u5bf9\u79f0\u5bc6\u7801\u5b66/\u5206\u7ec4\u5bc6\u7801\u5b66\u5e93](./blockCipher)\n\n + #### [SM4\u5206\u7ec4\u5bc6\u7801](./blockCipher/SM4.py)\n\n + ##### SM4\u652f\u6301\u5206\u7ec4\u957f\u5ea6128\u6bd4\u7279\uff0c\u5bc6\u94a5\u957f\u5ea6128\u6bd4\u7279\u7684\u5206\u7ec4\u5bc6\u7801\u52a0\u89e3\u5bc6\u8fd0\u7b97\n\n + ##### \u652f\u6301SM4\u7684ECB\u548cCBC\u7684\u5206\u7ec4\u5bc6\u7801\u5de5\u4f5c\u6a21\u5f0f\n\n + ##### \u652f\u6301\u57fa\u4e8eECB\u6216CBC\u5de5\u4f5c\u6a21\u5f0f\u7684\u5bf9\u6587\u4ef6\u7684\u52a0\u89e3\u5bc6\u5904\u7406\n\n+ ### [\u975e\u5bf9\u79f0\u5bc6\u7801\u5b66/\u516c\u94a5\u5bc6\u7801\u5b66\u5e93](./pubkeyCipher)\n\n + #### [RSA\u516c\u94a5\u5bc6\u7801](./pubkeyCipher/RSA.py)\n\n + ##### \u652f\u6301RSA\u5bc6\u94a5\u53c2\u6570\u7684\u751f\u6210\n\n + ##### \u652f\u6301RSA\u7684\u52a0\u89e3\u5bc6\u8fd0\u7b97\n\n + #### [SM2\u692d\u5706\u66f2\u7ebf\u516c\u94a5\u5bc6\u7801:\u516c\u94a5\u52a0\u5bc6\u7b97\u6cd5](./pubkeyCipher/SM2.py)\n\n + ##### \u652f\u6301\u6742\u51d1\u51fd\u6570\u4e3aSM3\uff08\u53ef\u66ff\u6362\uff09\u7684SM2\u516c\u94a5\u52a0\u5bc6\u7b97\u6cd5\n\n+ ### [\u54c8\u5e0c\u7b97\u6cd5/\u6742\u51d1\u51fd\u6570\u5e93](./hash)\n\n + #### [SM3\u5bc6\u7801\u6742\u51d1\u7b97\u6cd5](./hash/SM3.py)\n\n + ##### \u652f\u6301\u8f93\u51fa\u957f\u5ea6\u4e3a256\u6bd4\u7279\u7684\u6d88\u606f\u6458\u8981\uff0c\u6d88\u606f\u6458\u8981\u7684\u8f93\u51fa\u7c7b\u578b\u5305\u62ec\u5341\u516d\u8fdb\u5236\u5b57\u7b26\u4e32\u4ee5\u53ca\u5b57\u8282\u4e32\u4e24\u79cd\u7c7b\u578b\n\n + ##### \u652f\u6301\u5bf9\u6587\u4ef6\u7684\u6d88\u606f\u6458\u8981\u751f\u6210\n\n+ ### [\u6570\u5b57\u7b7e\u540d\u7b97\u6cd5](./digitalSignature)\n\n + #### [SM2\u692d\u5706\u66f2\u7ebf\u516c\u94a5\u5bc6\u7801\uff1a\u6570\u5b57\u7b7e\u540d\u7b97\u6cd5](./digitalSignature/SM2_SV.py)\n\n + ##### \u652f\u6301\u57fa\u4e8e\u692d\u5706\u66f2\u7ebf\u7684\u6570\u5b57\u7b7e\u540d\u7b97\u6cd5SM2\n\n\n\n## \u9879\u76ee\u7279\u8272\uff1a\n\n+ ### \u9762\u5411\u5bf9\u8c61\u7684\u7f16\u7a0b\u65b9\u5f0f\n\n <!--\u5f53\u7136\u4f5c\u4e3a\u521d\u5b66\u8005\uff0c\u672c\u9879\u76ee\u53ea\u662f\u57fa\u672c\u5b8c\u6210\u4e86\u9762\u5411\u5bf9\u8c61\u7684\u601d\u60f3\uff0c\u4e0e\u771f\u6b63\u5b8c\u6574\u7684\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u4ecd\u7136\u6709\u5f88\u5927\u7684\u5dee\u8ddd\uff0c\u5047\u671f\u4f1a\u7ee7\u7eed\u5b66\u4e60\uff0c\u52a0\u6df1\u5bf9\u9762\u5411\u5bf9\u8c61\u7f16\u7a0b\u7684\u7406\u89e3\u548c\u638c\u63e1-->\n\n+ ### \u7f16\u5199\u5927\u91cf\u6ce8\u91ca\uff0c\u4fbf\u4e8e\u4f7f\u7528\u4e0e\u7406\u89e3\n\n+ ### \u652f\u6301\u7b97\u6cd5\u9519\u8bef\u68c0\u67e5:\u5bc6\u94a5\u957f\u5ea6\u68c0\u67e5\u3001\u7b97\u6cd5\u5185\u90e8\u9519\u8bef\u5904\u7406\u7b49\n\n+ ### \u5bf9\u51fd\u6570\u63a5\u53e3\u53d8\u91cf\u8fdb\u884c\u4e86\u7c7b\u578b\u6307\u5b9a\uff0c \u652f\u6301\u8f93\u5165\u7c7b\u578b\u68c0\u67e5\n\n+ ### \u4f7f\u7528setup.py\u5bf9\u9879\u76ee\u6587\u4ef6\u8fdb\u884c\u4e86[\u6253\u5305](./dist/myCrypto-5.9.4.tar.gz)\n\n\n\n## \u9879\u76ee\u6837\u4f8b\uff1a\n\n### \u6e90\u7801\u8be6\u89c1[\u5b8c\u6574\u7248\u6d4b\u8bd5\u6837\u4f8b](./testSample/testSample.py)\n\n#### <!--\u5728\u4e3b\u7a0b\u5e8f\u90e8\u5206\u53ef\u4ee5\u6839\u636e\u6d4b\u8bd5\u8005\u7684\u9700\u6c42\uff0c\u6dfb\u52a0\u6216\u51cf\u5c11\u6ce8\u91ca\u4ee3\u7801\u8fdb\u884c\u90e8\u5206\u6d4b\u8bd5-->\n\n```python\nif __name__ == \"__main__\":\n \"\"\"\n \u53ef\u4ee5\u6839\u636e\u6d4b\u8bd5\u9700\u6c42\u8fdb\u884c\u4ee3\u7801\u6ce8\u91ca\u90e8\u5206\u7684\u6dfb\u52a0\u4e0e\u89e3\u9664\n \"\"\"\n \"\"\"\n basicMath\u6d4b\u8bd5\u6837\u4f8b\n \"\"\"\n basic_test()\n type_test()\n \tECC_test()\n GF_test()\n\n \"\"\"\n blockCipher\u6d4b\u8bd5\u6837\u4f8b\n \"\"\"\n SM4_test()\n\n \"\"\"\n pubkeyCipher\u6d4b\u8bd5\u6837\u4f8b\n \"\"\"\n RSA_test()\n SM2_test()\n\n \"\"\"\n hash\u6d4b\u8bd5\u6837\u4f8b\n \"\"\"\n SM3_test()\n\n \"\"\"\n digitalSignature\u6d4b\u8bd5\u6837\u4f8b\n \"\"\"\n SM2_SV_text()\n\n```\n\n<!--\u672c\u9879\u76ee\u7684\u5de5\u4f5c\u91cf\u4e3b\u8981\u6765\u81ea\u4e8e\u6587\u6863\u7684\u7f16\u5199\u3001\u4ee3\u7801\u7684\u6574\u5408\u3001\u51fd\u6570\u63a5\u53e3\u7684\u6539\u53d8\u3001\u9519\u8bef\u5904\u7406\u3001\u6d4b\u8bd5\u6837\u4f8b\u3001\u4ee5\u53ca\u6ce8\u91ca\u7b49-->\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "my crypto python package in 2023",
"version": "5.9.4",
"project_urls": null,
"split_keywords": [
"crypto"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e294f47cca6c78a539be40aa858f265716406ae0719f3a8fb9acded9d1819ee1",
"md5": "fa83ef60c38158cdbb9373d7d44f826a",
"sha256": "c72ebf2c090db84680a69147a73852a837b39793cb29471ce9403b6d5b5e209d"
},
"downloads": -1,
"filename": "liuzhCrypto-5.9.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fa83ef60c38158cdbb9373d7d44f826a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 21428,
"upload_time": "2023-05-26T09:43:36",
"upload_time_iso_8601": "2023-05-26T09:43:36.939489Z",
"url": "https://files.pythonhosted.org/packages/e2/94/f47cca6c78a539be40aa858f265716406ae0719f3a8fb9acded9d1819ee1/liuzhCrypto-5.9.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "83ee198be505707a0b4c7014f25deeab7dd2a22084a4e840d967f3fc137f2576",
"md5": "fc5cda60a4d553d8f66c17398447b35b",
"sha256": "87c804dfe65677470c9e3b1b6db70fd09c81460d3533e486a0a511b91f54b1ec"
},
"downloads": -1,
"filename": "liuzhCrypto-5.9.4.tar.gz",
"has_sig": false,
"md5_digest": "fc5cda60a4d553d8f66c17398447b35b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18599,
"upload_time": "2023-05-26T09:43:39",
"upload_time_iso_8601": "2023-05-26T09:43:39.332243Z",
"url": "https://files.pythonhosted.org/packages/83/ee/198be505707a0b4c7014f25deeab7dd2a22084a4e840d967f3fc137f2576/liuzhCrypto-5.9.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-26 09:43:39",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "liuzhcrypto"
}