{ "info": { "author": "Y. SOMDA", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. ::\n :maxdepth: 2\n :caption: Contents:\n\n**mod** -- modular arithmetic in Python\n=======================================\n\n.. image:: https://travis-ci.org/yoeo/mod.svg?branch=master\n :target: https://github.org/yoeo/mod\n :alt: Build Status\n\n.. image:: https://readthedocs.org/projects/mod/badge/?version=latest\n :target: http://mod.readthedocs.io/en/latest/?badge=latest\n :alt: Documentation Status\n\n\nDescription\n-----------\n\n`Modular arithmetic `_\nis arithmetic for integers, where numbers wrap around\nwhen reaching a given value called `modulus`.\nFor example ``6 \u2261 1 (mod 5)``.\nModular arithmetic has several practical applications including:\n`music `_,\n`banking `_,\n`book publishing `_,\n`cryptography `_...\nand of course math.\n\nThe purpose of this package is to simplify\nthe use of modular arithmetic in **Python3**.\n\n.. images/mod.png\n\nUsage\n-----\n\nThis package provides ``Mod`` integers\nthat compute arithmetic operations like ``+ - * // **`` with a modulus:\n\n.. code-block:: python\n\n from mod import Mod\n\n # Funny math here\n\n x = Mod(5, 7) # x \u2261 5 (mod 7)\n\n (x + 2) == 0 # True: 5 + 2 \u2261 7 \u2261 0 (mod 7)\n (x + 7) == x # True: 5 + 7 \u2261 12 \u2261 5 (mod 7)\n (x**3) == (x + 1) # True: 5\u00b3 \u2261 125 \u2261 6 (mod 7)\n (1 // x) == 3 # True: 5 \u00d7 3 \u2261 15 \u2261 1 (mod 7) \u21d2 5\u207b\u00b9 \u2261 3 (mod 7)\n\nA naive implementation of\n`RSA encryption algorithm `_\nusing ``mod`` package:\n\n.. code-block:: python\n\n from mod import Mod\n\n\n # My RSA keys\n public_key = Mod(3, 61423)\n private_key = Mod(40619, 61423)\n\n # My very secret message\n top_secret_message = 666\n\n # RSA encryption\n encrypted = top_secret_message**public_key\n\n # RSA decryption\n decrypted = encrypted**private_key\n\n # My secret message have been correctly encrypted and decrypted :-)\n assert decrypted == top_secret_message\n\n.. note::\n\n * ``Mod`` is based on integer modulo operation ``%``, not ``math.fmod``\n * the result of an operation between a ``Mod`` and an ``int`` is a ``Mod``\n * the result of an operation between a ``Mod`` and a ``float`` is a ``float``\n\nPackage documentation: ``mod.Mod``\n----------------------------------\n\n.. :: mod.Mod\n :members:\n\nInstall\n-------\n\nRun the following command to install ``mod`` package\n\n.. code-block:: bash\n\n pip3 install mod\n\nLinks\n-----\n\n* Package documentation located at http://mod.readthedocs.io/en/latest/\n* Python package available at https://pypi.python.org/pypi/mod\n* Source code repository: https://github.com/yoeo/mod\n\nIndices\n-------\n\n.. `genindex`\n.. `modindex`\n.. `search`\n\n**mod** \u2014 Copyright (c) 2017 Y. SOMDA, `MIT License `_\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/yoeo/mod", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "mod", "package_url": "https://pypi.org/project/mod/", "platform": "any", "project_url": "https://pypi.org/project/mod/", "project_urls": { "Homepage": "https://github.com/yoeo/mod" }, "release_url": "https://pypi.org/project/mod/0.2.4/", "requires_dist": null, "requires_python": ">=3", "summary": "Modular arithmetic in Python", "version": "0.2.4" }, "last_serial": 4196494, "releases": { "0.2.3": [ { "comment_text": "", "digests": { "md5": "7696bd0478f998226cff80e9a7e71829", "sha256": "6ba05cfe46607b2c76e8cbba16cb014570a2f7619653022c479be3c7bdf4e852" }, "downloads": -1, "filename": "mod-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "7696bd0478f998226cff80e9a7e71829", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 6090, "upload_time": "2017-11-02T01:07:33", "url": "https://files.pythonhosted.org/packages/8d/a7/3f4610a83c3043ee1e6f9ca5e8de15f65a5cb30a19855a4cf1fdf2190ce7/mod-0.2.3-py3-none-any.whl" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "92bd4481d272167fe845b625e3bdd10e", "sha256": "806b3816ad6123c42b224ff9aeb4ac95bf7eb05ef5163ff623038798ccb39b15" }, "downloads": -1, "filename": "mod-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "92bd4481d272167fe845b625e3bdd10e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 3960, "upload_time": "2018-08-22T15:07:36", "url": "https://files.pythonhosted.org/packages/c9/83/47b13b015c738effd19c076397f47e83958adee99396702d029ea9c7a522/mod-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dca4025408ec80bf0c4cb3241b4685c7", "sha256": "eb525f9478d77516cba65a5dce394c531772680c322ba4605dae150010d5e2b2" }, "downloads": -1, "filename": "mod-0.2.4.tar.gz", "has_sig": false, "md5_digest": "dca4025408ec80bf0c4cb3241b4685c7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4274, "upload_time": "2018-08-22T15:07:37", "url": "https://files.pythonhosted.org/packages/e3/f4/eee654b45e7078f6d9f4ddce4364f5c47a8eec08ccbc1910bf4a60044dda/mod-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "92bd4481d272167fe845b625e3bdd10e", "sha256": "806b3816ad6123c42b224ff9aeb4ac95bf7eb05ef5163ff623038798ccb39b15" }, "downloads": -1, "filename": "mod-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "92bd4481d272167fe845b625e3bdd10e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3", "size": 3960, "upload_time": "2018-08-22T15:07:36", "url": "https://files.pythonhosted.org/packages/c9/83/47b13b015c738effd19c076397f47e83958adee99396702d029ea9c7a522/mod-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dca4025408ec80bf0c4cb3241b4685c7", "sha256": "eb525f9478d77516cba65a5dce394c531772680c322ba4605dae150010d5e2b2" }, "downloads": -1, "filename": "mod-0.2.4.tar.gz", "has_sig": false, "md5_digest": "dca4025408ec80bf0c4cb3241b4685c7", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 4274, "upload_time": "2018-08-22T15:07:37", "url": "https://files.pythonhosted.org/packages/e3/f4/eee654b45e7078f6d9f4ddce4364f5c47a8eec08ccbc1910bf4a60044dda/mod-0.2.4.tar.gz" } ] }