# 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:
```python
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:
```python
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))
```
Raw data
{
"_id": null,
"home_page": "",
"name": "elgamal-anass-daniel",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,elgamal,encryption,chyper",
"author": "Anass Anhari & Daniel Alamillo",
"author_email": "<anassanhari@estudiantat-upc.edu>",
"download_url": "https://files.pythonhosted.org/packages/b0/ea/e9ee6933bd31a1adc4a2faef41728eb027c9ae66d1319322cff042ff1e8a/elgamal_anass_daniel-0.0.4.tar.gz",
"platform": null,
"description": "\n# elgamal-anass-daniel\n\nA friendly module for testing ElGamal Cryptosystem.\nMoreover, it also brings futures such as validating primitive roots, obtaining them, and optimized operations such as Fast Modular Exponentiation.\n\nDeveloped by Anass Anhari & Daniel Alamillo (c) 2023\n\n## Examples of How To Use\n\nElGamal built-in and optimized operations:\n\n```python\nfrom ElGamal import ElGamal\n\nelGamal = ElGamal()\n\n# Fast Modular Exponentiation\nelGamal.FastModExp(g=2, e=284523875345345, p=456), 32) #\u00a032\nelGamal.FastModExp(g=100, e=284523875345345, p=456) #\u00a0256\n\n#\u00a0Obtain Primitive Roots\nelGamal.getPrimitiveRoots(5) # [2, 3]\nelGamal.getPrimitiveRoots(29) #\u00a0[2, 3, 8, 10, 11, 14, 15, 18, 19, 21, 26, 27]\n\n# Obtain the First Primitive Root\nelGamal.getFirstPrimitiveRoot(6) # None\nelGamal.getPrimitiveRoots(29) #\u00a02\n\n#\u00a0Test a Primitive Root\nelGamal.isPrimitive(725, 829) #\u00a0True\nelGamal.isPrimitive(41, 101) #\u00a0False\n\nmsg1 = ElGamal.Message(\"[Msg-1] Hola que tal estas! :D\")\nmsg1.encrypt(g=2, g_x=1024, p=8820220609)\nprint(msg1.decrypt(x=10, p=8820220609))\n```\n\nCreate a message, encrypt it and decrypt it:\n\n```python\nfrom ElGamal import Message\n\nmsg1 = Message(\"[Msg-1] Hola que tal estas! :D\")\nmsg1.encrypt(g=2, g_x=1024, p=8820220609)\nprint(msg1.decrypt(x=10, p=8820220609))\n```\n\n",
"bugtrack_url": null,
"license": "",
"summary": "ElGamal encryption",
"version": "0.0.4",
"split_keywords": [
"python",
"elgamal",
"encryption",
"chyper"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5254abc548f6a0f373e7af81425e61dc396f76369a045e7ef9157e81cdb1f4e8",
"md5": "510f95b5085b3aef0c6ed072728ae320",
"sha256": "e62dabff4e743c616c657c038b618e1dd5cdf60ca17f7f59471423b5522f07be"
},
"downloads": -1,
"filename": "elgamal_anass_daniel-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "510f95b5085b3aef0c6ed072728ae320",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4271,
"upload_time": "2023-01-26T23:55:55",
"upload_time_iso_8601": "2023-01-26T23:55:55.467301Z",
"url": "https://files.pythonhosted.org/packages/52/54/abc548f6a0f373e7af81425e61dc396f76369a045e7ef9157e81cdb1f4e8/elgamal_anass_daniel-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b0eae9ee6933bd31a1adc4a2faef41728eb027c9ae66d1319322cff042ff1e8a",
"md5": "56cf532fc487c5ba64f5f65b85f4bdc3",
"sha256": "70a2cf2c6bd6783d42bf5bc2d3710b7b77f1df398ffcd9ddd3c6066b5d2690c1"
},
"downloads": -1,
"filename": "elgamal_anass_daniel-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "56cf532fc487c5ba64f5f65b85f4bdc3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3998,
"upload_time": "2023-01-26T23:55:59",
"upload_time_iso_8601": "2023-01-26T23:55:59.178585Z",
"url": "https://files.pythonhosted.org/packages/b0/ea/e9ee6933bd31a1adc4a2faef41728eb027c9ae66d1319322cff042ff1e8a/elgamal_anass_daniel-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-26 23:55:59",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "elgamal-anass-daniel"
}