python version of rsa
Project description
Python 实现RSA、AES加解密
项目立意是为了解除python多数库只能使用公钥加密的限制。
示例
RSA加解密
from RealCrypto import Rsa
pyrsa = Rsa()
pub_key = """
-----BEGIN RSA PUBLIC KEY-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END RSA PUBLIC KEY-----
"""
data = "1bff1dfb66a599777dfe4d5edad268d41866e8f82d9604d6b750e2106b292cf2e11690420f515c3fe06d5fe851dc977e1eb3f0f610881659cb8fbf78e3e0dbc260dd7876146fc2b0e24a059fdf4d9540e8b1f9f755006085f491980248c345da03ff50edb77561bc5a304dc9ab658540cfbed4ebf828a351058abe7af508d5a19fa8dce65955d4f535618cba8fa115454fac166bf53784d51f319a56e3de071d766bda8c1683a74f10c9ee873daa710d233b53bcf8cbf7e0f9e48c13d9a1096ee3971c7c35b1b4bf4a4c6cdb4518c75147d5a21ed17fe161075baad4512ab3d4cf994f1bd5ca983fbf255f65b6a5d321ed68999cbff9b7e1b5dc9fc358d7a247"
ret = pyrsa.pub_decrypt(bytes.fromhex(data), pub_key)
print(ret)
ret = pyrsa.pub_encrypt("23342321",pub_key)
print(ret)
AES加解密
from RealCrypto import Aes,AesType
pyaes = Aes()
key = "1234657887654321"
iv = "1236547896325418"
plaintext = "just a test"
ret = pyaes.encrypt(plaintext,AesType.evp_aes_128_cbc, key,iv)
ret = pyaes.decrypt(ret,AesType.evp_aes_128_cbc, key,iv)
assert plaintext,ret.decode("utf-8")
Hash算法
teststr = "just a test"
# 字符串hash
ret = hash.md5(teststr)
print(ret.hex())
ret = hash.sha256(teststr)
print(ret.hex())
filepath = "test.txt"
# 文件hash
ret = hash.md5withfile(filepath)
print(ret.hex())
ret = hash.sha256withfile(filepath)
print(ret.hex())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file realcrypto-0.1.0.tar.gz.
File metadata
- Download URL: realcrypto-0.1.0.tar.gz
- Upload date:
- Size: 77.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6425ca6e7d098a6575271bce31d6b92bdb1d70ddf162f953aeeb9b1a30ef5d89
|
|
| MD5 |
cdaf247fb82d7d963b0b6c89651bc37d
|
|
| BLAKE2b-256 |
af7b52e0b9eba36dc2d4aff523dbac75fc39b3af6bcfe503dcfe78aaf56fa86a
|
File details
Details for the file RealCrypto-0.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 45.7 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d73d5a65f0d09b60009119d2673417c4ee67ae0ce773881c84f08e0dac6da751
|
|
| MD5 |
c6e752b9a76812b07e2e8d1eb6138a57
|
|
| BLAKE2b-256 |
fbb910cfb02d2c269275dc810d127134d0d8b85711f647c2a73394cdd062b4b5
|
File details
Details for the file RealCrypto-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15f35ca95c01a888376a0b51a2fe435389f042b2d725002b325b29369f3979ab
|
|
| MD5 |
b7d89f09503a88dd88c7d04d93ef2c5a
|
|
| BLAKE2b-256 |
f96657a6a486ccdb141f9acd85afc02aa703abc437c759cc5f93ecea474a9ac5
|
File details
Details for the file RealCrypto-0.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 45.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3732670fb87ce68e071797d6147074806d4e528cb67cc31420c53708ae01519a
|
|
| MD5 |
88e202ee23d0f61a643f2778a7904253
|
|
| BLAKE2b-256 |
b10c9ca1bd89a2766f27992c40a6dbe8526749bb7a10bcb429b948f30d661bc1
|
File details
Details for the file RealCrypto-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fb2ec8d7d604e568abd11377ff88b0754a919c7f3760d649848ec703203a666
|
|
| MD5 |
877d208f0cb4770a4ed187f5ba34f6fd
|
|
| BLAKE2b-256 |
9298d173ecad51649a34d7ab3af93783aebb0b9602d503ad27f82e2d714bb7a1
|
File details
Details for the file RealCrypto-0.1.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 45.8 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4d1154b59ee4af41c7c579bb577ac7d1811af8bc3f75cf015f4e4ef4d0416f6
|
|
| MD5 |
bdc7902b964dfb3f722695edd78fa9a1
|
|
| BLAKE2b-256 |
0c49bdd9da863565daa72fb4b117a651d838c65c05d466f67367f429e421bbf7
|
File details
Details for the file RealCrypto-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9696353745ebaad87607d0d62ed0054c060ece3423d68c678b9cd673a4f6a77c
|
|
| MD5 |
ba6f19db5d252f92257ce1bdc5d1038c
|
|
| BLAKE2b-256 |
0b6204a3e9491610f1d944ee2d278890ad5a4c7e5eedfa410a67d467fe8d0edf
|
File details
Details for the file RealCrypto-0.1.0-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 46.2 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe252d01fb91349ad52e51355da137e7af35669957bc98fd60e30172072ef5ea
|
|
| MD5 |
72c7803eab834693d95f0d86fe74c18c
|
|
| BLAKE2b-256 |
cccbea191756b6eb08fb79333d1fce2dd797467056f5d2e0aeccc042bc8dc811
|
File details
Details for the file RealCrypto-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp39-cp39-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
91527398b5096e166a975627a264dbcf9035a5f11ffa28c3c6e98c5ec71f5dc4
|
|
| MD5 |
47877ce61c30f46bf8ec66ca93b57d83
|
|
| BLAKE2b-256 |
3999d3320c914347c638ad452c02e5bb19d98ece88dcb8ac3b1bd1e707a2286a
|
File details
Details for the file RealCrypto-0.1.0-cp38-cp38-win_amd64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 46.5 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
510a364b2675cd7246864654a79cb9c5b754dc46fffcf04dc9d0e75d9191154e
|
|
| MD5 |
222bc1ae3e0b5ad3fc3c93d5f4ef8546
|
|
| BLAKE2b-256 |
c09de9153363d071e03b873f6917be6287256e70a018c0c303a5f2bc2b7ee52e
|
File details
Details for the file RealCrypto-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: RealCrypto-0.1.0-cp38-cp38-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c034e253af1275fc2c67340a80095aeaa916aabd3aecbd970ef8f43a3adb64c5
|
|
| MD5 |
8f7d7611186ac6f7c1f43ca010766da2
|
|
| BLAKE2b-256 |
91d24b9555ca8affa3b9e95e06550bbb5043ccbe3d17cf1d3cee8478174271db
|