Module for fast calculating large primes, and RSA encryption and decryption of data of any size
Project description
eng: This module implements encryption using the RSA algorithm, as well as indirectly fast and reliable calculation of prime numbers To generate keys, use the function RSA.get_bit_keys(number of bits to calculate the desired key)
import RSA_tool
e, d, n = RSA_tool.RSA.get_bit_keys(256)
To encrypt information, use the block encryption function, you can quickly encrypt information of any size
import RSA_tool
e, d, n = RSA_tool.RSA.get_bit_keys(256)
m = 'hello world'
print(n)
c = RSA_tool.RSA.block_encrypt(m, e, n)
print(c)
To decrypt the message, use the block decryption function
import RSA_tool
e, d, n = RSA_tool.RSA.get_bit_keys(256)
m = 'hello world'
print(n)
c = RSA_tool.RSA.block_encrypt(m, e, n)
print(c)
m = RSA_tool.RSA.block_decrypt(c, d, n)
print(m)
For an example of working with the module and testing it, refer to the main.py file
rus: Данный модуль реализует шифрование по алгоритму RSA, а так же косвенно быстрое и надёжное вычисление простых чисел Для генерации ключей воспользуйтесь функцией RSA.get_bit_keys(число бит для вычисления желаемого ключа)
import RSA_tool
e, d, n = RSA_tool.RSA.get_bit_keys(256)
Для шифрования информации используйте функцию блочного шифрования, Вы можете достаточно быстро шифровать информацию любого объёма
import RSA_tool
e, d, n = RSA_tool.RSA.get_bit_keys(256)
m = 'hello world'
print(n)
c = RSA_tool.RSA.block_encrypt(m, e, n)
print(c)
Для расшифрования сообщения используйте фунцию блочного расшифрования
import RSA_tool
e, d, n = RSA_tool.RSA.get_bit_keys(256)
m = 'hello world'
print(n)
c = RSA_tool.RSA.block_encrypt(m, e, n)
print(c)
m = RSA_tool.RSA.block_decrypt(c, d, n)
print(m)
Для примера работы с модулем и его тестирования обратитесь к файлу main.py
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file rsatool-0.1.1.tar.gz.
File metadata
- Download URL: rsatool-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a39a784baa4c3b14f16146453b9f3363497e2dd5ef50895424df1a9fa826c20
|
|
| MD5 |
a33900853732e37dd0f5dc242d232931
|
|
| BLAKE2b-256 |
7e797c212f19e1d82d87417049df50193439ea84d3f64aca25d1bdd6e7a79005
|