Skip to main content

liuzhCrypto Python 库

项目介绍

  • 性质:本项目是BUAA-网络空间安全学院-2023年春季密码学实验课程大作业

  • 作者:BUAA-网络空间安全学院2021级-21371445-刘征昊

  • 概述:本项目采用面向对象编程的方式对本学期实验代码进行整合以及完善,制作了个人的密码学库

  • 支持github和PyPI:latest release请关注Github

项目目录结构

liuzh594Crypto
├── LICENSE
├── README.md
├── liuzh594Crypto # 包
│   ├── __init__.py
│   ├── basicMath # 基础数学库
│   │   ├── __init__.py
│   │   ├── ECC.py
│   │   ├── GF.py
│   │   ├── basic.py
│   │   └── type.py
│   ├── blockCipher # 分组密码学库
│   │   ├── __init__.py
│   │   ├── SM4.py
│   ├── digitalSignature # 数字签名库
│   │   ├── __init__.py
│   │   ├── SM2_SV.py
│   ├── hash # 哈希算法库
│   │   ├── __init__.py
│   │   ├── SM3.py
│   ├── pubkeyCipher # 公钥密码学库
│   │   ├── __init__.py
│   │   ├── RSA.py
│   │   ├── SM2.py
│   └── tests # 测试样例库
│       ├── __init__.py
│       ├── pic_original.bmp
│       ├── pic_original_CBC.bmp
│       ├── pic_original_ECB.bmp
│       └── tests.py
└── setup.py

项目功能

项目特色

  • 面向对象的编程方式

    • 当然作为初学者,本项目只是基本完成了面向对象的思想,与真正完整的面向对象编程仍然有很大的差距,假期会继续学习,加深对面向对象编程的理解和掌握
  • 编写大量注释,便于使用与理解

    • 详情见代码
  • 支持算法错误检查:

    • 密钥长度检查
    • 算法内部错误
    • ... ...
  • 对函数接口变量进行了类型指定, 支持输入类型检查

  • 提供大量测试样例,覆盖功能全面

  • 使用setup.py对项目文件进行了打包

项目安装:

  • mac/Linux:

    python3 -m pip install liuzh594Crypto
    
  • windows:

    python -m pip install liuzh594Crypto
    
    • 对于 POSIX 用户(包括 macOS 和 Linux 用户)本指南中的示例假定使用了 [virtual environment/pyenv]。对于 Windows 用户,本指南中的示例假定在安装 Python 时选择了修改系统 PATH 环境变量。

项目样例

  • 源码详见完整版测试样例

  • 在主程序部分可以根据测试者的需求,添加或减少注释函数进行部分测试

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()

写在最后

  • 本项目的工作量主要来自于

    • 项目库的搭建
    • 文档的编写
    • 代码的整合
    • 函数接口设置
    • 错误处理
    • 测试样例
    • 注释
    • ... ...
  • 本项目已上传至github

  • 本项目已上传至PyPI

Metadata

Release files for liuzh594Crypto 5.9.4.999.999

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liuzh594Crypto 5.9.4.999.999
File Size Uploaded
liuzh594crypto-5.9.4.999.999.tar.gz 22.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for liuzh594Crypto 5.9.4.999.999
File Interpreter ABI Platform
liuzh594Crypto-5.9.4.999.999-py3-none-any.whl Python 3 none any Details

Total release size: 49.3 kB

Release files / liuzh594crypto-5.9.4.999.999.tar.gz

Download URL liuzh594crypto-5.9.4.999.999.tar.gz
Size 22.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c11dd0b14032eb90cca6ebd196325e1f318dd3f54b431aa8d28bfabb7a309de0
BLAKE2b-256 checksum
How to use checksums
689f51b167536076cdc9ac2f77ffef8243d95ab0ee450ff5153607757549217a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.2

Release files / liuzh594Crypto-5.9.4.999.999-py3-none-any.whl

Download URL liuzh594Crypto-5.9.4.999.999-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7c20ea418639096feb0efb0334f0b6ba2d70347bdff41624893bf0eef891f16
BLAKE2b-256 checksum
How to use checksums
bc29c619b3ab02073d5ace5acd939fb0020af5220ff17730a9fa96d33af8c2c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.12.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page