ElGamal encryption
Project description
elgamal-anass-daniel
A friendly module for testing ElGamal Cryptosystem. Moreover, it also brings futures such as validating primitive roots, obtaining them, and optimized operations such as Fast Modular Exponentiation.
Developed by Anass Anhari & Daniel Alamillo (c) 2023
Examples of How To Use
ElGamal built-in and optimized operations:
from ElGamal import ElGamal
elGamal = ElGamal()
# Fast Modular Exponentiation
elGamal.FastModExp(g=2, e=284523875345345, p=456), 32) # 32
elGamal.FastModExp(g=100, e=284523875345345, p=456) # 256
# Obtain Primitive Roots
elGamal.getPrimitiveRoots(5) # [2, 3]
elGamal.getPrimitiveRoots(29) # [2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26, 27]
# Obtain the First Primitive Root
elGamal.getFirstPrimitiveRoot(6) # None
elGamal.getPrimitiveRoots(29) # 2
# Test a Primitive Root
elGamal.isPrimitive(725, 829) # True
elGamal.isPrimitive(41, 101) # False
msg1 = ElGamal.Message("[Msg-1] Hola que tal estas! :D")
msg1.encrypt(g=2, g_x=1024, p=8820220609)
print(msg1.decrypt(x=10, p=8820220609))
Create a message, encrypt it and decrypt it:
from ElGamal import Message
msg1 = Message("[Msg-1] Hola que tal estas! :D")
msg1.encrypt(g=2, g_x=1024, p=8820220609)
print(msg1.decrypt(x=10, p=8820220609))
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
Built Distribution
Close
Hashes for elgamal-anass-daniel-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2817cdf792aa891704e4c36b586351cdbfb93f9395c6594c3023c21aae2c09a |
|
MD5 | 59fd0603de6329f980dbcbecfdae2661 |
|
BLAKE2b-256 | 43662ad2b32cfd0a6adfe03873f12e28466ccb67e4511e29ae50cf5ecef7e1de |
Close
Hashes for elgamal_anass_daniel-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34bfc414de43f74cf658c7c52aff1911be3344f4f3b3b2b0d0294068c98b6e03 |
|
MD5 | 8c372896197508546df41e47fa940149 |
|
BLAKE2b-256 | 448511beaccd1509e35a21cf9e9675fbb048344d6c16fd49181a6ef13912b49f |