sparrowEncryptionDecryption
目录
简介
- sparrowEncryptionDecryption 加密解密库是一个用于数据加密和解密的 Python 库,支持二进制和四进制两种加密模式,并提供同步和异步接口。
安装
pip install sparrowEncryptionDecryption
入口
- 导入类方式
主入口
- 直接从sparrowEncryptionDecryption导入
import sparrowEncryptionDecryption as sed
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
from sparrowEncryptionDecryption import SparrowEncryptionDecryptionAsync
子入口
- 从sparrowEncryptionDecryption.encryption_decryption导入
from sparrowEncryptionDecryption.encryption_decryption import SparrowEncryption
from sparrowEncryptionDecryption.encryption_decryption import SparrowEncryptionAsync
from sparrowEncryptionDecryption.encryption_decryption import SparrowDecryption
from sparrowEncryptionDecryption.encryption_decryption import SparrowDecryptionAsync
from sparrowEncryptionDecryption.encryption_decryption import SparrowEncryptionDecryption
from sparrowEncryptionDecryption.encryption_decryption import SparrowEncryptionDecryptionAsync
分入口
- 从sparrowEncryptionDecryption.encryption_decryption.function导入
from sparrowEncryptionDecryption.function.decryption import SparrowDecryption
from sparrowEncryptionDecryption.function.decryption import SparrowDecryptionAsync
from sparrowEncryptionDecryption.function.encryption import SparrowEncryption
from sparrowEncryptionDecryption.function.encryption import SparrowEncryptionAsync
使用
- sparrowEncryptionDecryption的使用方法
- sparrowEncryptionDecryption相关类初始化有六个参数,不输入则使用默认秘钥集
- order_keys1: order方法第一次解密秘钥
- order_keys2: order方法第二次解密秘钥
- easy_keys1: easy方法第一次解密秘钥
- easy_keys2: easy方法第二次解密秘钥
加密
- sparrowEncryptionDecryption的加密方法
- 一个有两种方法
- order_encryption
- easy_encryption
- random_encryption
- full_random_encryption
order_encryption
- 使用order_encryption方法加密数据
- 携带五个参数
- string: 需要被加密的数据
- key: 秘钥
- effective_duration: 秘钥过期时间,-1为永不过期,默认-1
- is_compression: 默认为2,二次压缩压缩,1为一次压缩,0为不压缩
- mode: 加密模式,0为二进制加密,1为四进制加密,默认为0
- compression_type: 压缩算法(zlib、gzip、bz2、lzma、lz4、brotli、snappy、huffman、deflate、lz77)
- 返回被加密好的数据
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.order_encryption("test", "test")
easy_encryption
- 使用easy_encryption方法加密数据
- 携带三个参数
- string: 需要被加密的数据
- key: 秘钥
- mode: 加密模式,0为二进制加密,1为四进制加密,默认为0
- compression_type: 压缩算法(zlib、gzip、bz2、lzma、lz4、brotli、snappy、huffman、deflate、lz77)
- 返回被加密好的数据
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.easy_encryption("test", "test")
random_encryption
- 使用random_encryption方法加密数据
- 携带五个参数
- string: 需要被加密的数据
- key: 秘钥
- effective_duration: 秘钥过期时间,-1为永不过期,默认-1
- is_compression: 默认为2,二次压缩压缩,1为一次压缩,0为不压缩
- mode: 加密模式,0为二进制加密,1为四进制加密,默认为0
- compression_type: 压缩算法(zlib、gzip、bz2、lzma、lz4、brotli、snappy、huffman、deflate、lz77)
- 返回被加密好的数据以及二进制秘钥
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.random_encryption("test", "test")
full_random_encryption
- 使用full_random_encryption方法加密数据
- 携带五个参数
- string: 需要被加密的数据
- key: 秘钥
- effective_duration: 秘钥过期时间,-1为永不过期,默认-1
- is_compression: 默认为2,二次压缩压缩,1为一次压缩,0为不压缩
- mode: 加密模式,0为二进制加密,1为四进制加密,默认为0
- compression_type: 压缩算法(zlib、gzip、bz2、lzma、lz4、brotli、snappy、huffman、deflate、lz77)
- 返回被加密好的数据以及二进制秘钥
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.full_random_encryption("test", "test")
解密
- sparrowEncryptionDecryption的解密方法
- 一个又两种方法
- order_decryption
- easy_decryption
- random_decryption
- full_random_decryption
order_decryption
- 使用order_decryption方法解密数据
- 携带两个参数
- decompression: 需要被解密的数据
- key: 秘钥
- compression_type: 压缩算法(zlib、gzip、bz2、lzma、lz4、brotli、snappy、huffman、deflate、lz77)
- 返回被解密的数据或秘钥错误类型
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.order_decryption("test", "test")
easy_decryption
- 使用easy_decryption方法解密数据
- 携带两个参数
- decompression: 需要被解密的数据
- key: 秘钥
- compression_type: 压缩算法(zlib、gzip、bz2、lzma、lz4、brotli、snappy、huffman、deflate、lz77)
- 返回被解密的数据或秘钥错误类型
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.easy_decryption("test", "test")
random_decryption
- 使用random_decryption方法解密数据
- 携带两个参数
- decompression: 需要被解密的数据
- key: 秘钥(二进制秘钥)
- 返回被解密的数据或秘钥错误类型
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.random_decryption("test", b"test")
full_random_decryption
- 使用full_random_decryption方法解密数据
- 携带两个参数
- decompression: 需要被解密的数据
- key: 秘钥(二进制秘钥)
- 返回被解密的数据或秘钥错误类型
from sparrowEncryptionDecryption import SparrowEncryptionDecryption
sed = SparrowEncryptionDecryption()
sed.full_random_decryption("test", b"test")
工具
- sparrowEncryptionDecryption涉及使用到的工具方法
binary_to_quaternary
- 将二进制转换为四进制
- 携带一个参数
- binary: 二进制串
- 返回二进制的四进制数据
quaternary_to_binary
- 将四进制转换为二进制
- 携带一个参数
- quaternary: 四进制串
- 返回四进制的二进制数据
string_to_binary
- 将字符串转换为二进制
- 携带一个参数
- string: 字符串
- 返回字符串的二进制数据
binary_to_string
- 将二进制转换为字符串
- 携带一个参数
- binary: 二进制串
- 返回二进制代表的字符串
split_pairwise
- 将字符串两两分为一组并存入数组
- 携带一个参数
- string: 被分割的字符串
- 返回分割好的数组
split_double_pairwise
- 将字符串每四个分为一组并存入数组
- 携带一个参数
- string: 被分割的字符串
- 返回分割好的数组
order_compression_and_decompression2
- 将加密内容进行二次压缩或解压
- 携带三个参数
- keys2: 密钥对
- mode: True为加密,False为解密,bool类型
- data: 需要被压缩或解压的数据
- 返回被压缩或解压的数据
order_compression_and_decompression
- 将加密内容压缩或解压
- 携带三个参数
- keys2: 密钥对
- mode: True为加密,False为解密,bool类型
- data: 需要被压缩或解压的数据
- 返回被压缩或解压的数据
shuffle_by_seed
- 根据输入字符串作为种子打乱数组
- 携带两个参数
- input_string: 用于生成随机种子的字符串
- array: 需要被打乱的数组
- 打乱后的新数组
get_random_key
- 生成随机密钥对
- 携带两个参数
- keys: 秘钥键
- values: 秘钥值
choice_key
- 获取指定数组中指定数量的随机值
- 携带两个参数
- key_list: 指定数组
- length: 指定数量
Metadata
Release files for sparrowEncryptionDecryption 0.4.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sparrowencryptiondecryption-0.4.2.2.tar.gz | 25.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sparrowencryptiondecryption-0.4.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.1 kB
Release files / sparrowencryptiondecryption-0.4.2.2.tar.gz
| Download URL | sparrowencryptiondecryption-0.4.2.2.tar.gz |
|---|---|
| Size | 25.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef881e0220bc828726a606a7c13c2d04313d489b38e93d78da146bf241ccdfc2
|
|
BLAKE2b-256 checksum How to use checksums |
a396364d10a1f8d75fb031a91414c550f256a8aab41cc841416f2ea99bcf4b7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.5
|
Release files / sparrowencryptiondecryption-0.4.2.2-py3-none-any.whl
| Download URL | sparrowencryptiondecryption-0.4.2.2-py3-none-any.whl |
|---|---|
| Size | 26.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec9078263f99b22c2bfc2765474eef4ccbc1b38eb31112c923e1292fa52ffae3
|
|
BLAKE2b-256 checksum How to use checksums |
93c827097d4552a7b2770f34288bd128938f3a859fa9e067baa1f96140f0bffb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.5
|