{ "info": { "author": "Alexander Maslyaev", "author_email": "maslyaev@gmail.com", "bugtrack_url": null, "classifiers": [], "description": " \r\r\n This little module is a simple and reliable way to improve randomness of any random or pseudo-random number generator.\r\r\n \r\r\n We never being 100% sure in real randomness and cryptographic quality of any externally-provided RNG, and this is a good idea to be able to add some addition entropy to by own hands. This module provides following features:\r\r\n 1. Easy way to combine unrestricted number of randomness sources (CompoundRandom class).\r\r\n 2. Tool to transform several additional bytes of extra entropy into complete random-like mess (HashRandom class).\r\r\n \r\r\n ### Why we can be sure that combining independent random sources can only improve quality of RNG\r\r\n \r\r\n \r\r\n ### How to embed\r\r\n \r\r\n There are two ways to embed this functionality into your project:\r\r\n 1. Get this module by `pip install random_xe` and then import into your module by `import random_xe`.\r\r\n 2. Directly download [random_xe.py](/random_xe.py) file and adopt it into your project.\r\r\n \r\r\n ### How to use\r\r\n \r\r\n Import this module:\r\r\n ```python\r\r\n >>> import random_xe\r\r\n ```\r\r\n Create and try HashRandom PRNG initialized with 'Hello world':\r\r\n ```python\r\r\n >>> import random_xe\r\r\n >>> myrandom1 = random_xe.HashRandom('Hello world')\r\r\n >>> myrandom1.randint(100, 200)\r\r\n 156\r\r\n >>> myrandom1.gauss(20, 10)\r\r\n 8.243867125227318\r\r\n ```\r\r\n myrandom1 uses SHA-256 hashing function (option by default).\r\r\n \r\r\n Let`s try to combine this PRNG with another HashRandom based on SHA3-512 and initialized from user input:\r\r\n ```python\r\r\n >>> from hashlib import sha3_512\r\r\n >>> myrandom2 = random_xe.CompoundRandom(myrandom1, random_xe.HashRandom(input('Type somethig: '), sha3_512))\r\r\n Type somethig: ldjggndjKfuT830\r\r\n >>> myrandom2.getrandbits(128)\r\r\n 171962833922528548054430533031273437533\r\r\n ```\r\r\n \r\r\n It is very good idea ALWAYS combine additional entropy with SystemRandom source:\r\r\n ```python\r\r\n >>> from getpass import getpass\r\r\n >>> from time import perf_counter\r\r\n >>> # Three sources:\r\r\n >>> # - SystemRandom;\r\r\n >>> # - user input;\r\r\n >>> # - timing.\r\r\n >>> def super_myrandom():\r\r\n t_start = perf_counter()\r\r\n return random_xe.CompoundRandom(random_xe.SystemRandom(),\r\r\n random_xe.HashRandom(\r\r\n getpass('Type somethig:'), sha3_512),\r\r\n random_xe.HashRandom(perf_counter() - t_start))\r\r\n \r\r\n >>> myrandom3 = super_myrandom()\r\r\n >>> myrandom3.getrandbits(128)\r\r\n 214560115455406687033892278367232976155\r\r\n ```\r\r\n \r\nKeywords: random rng prng\r\nPlatform: UNKNOWN\r\nClassifier: Development Status :: 5 - Production/Stable\r\nClassifier: Intended Audience :: Developers\r\nClassifier: Intended Audience :: Education\r\nClassifier: Intended Audience :: Science/Research\r\nClassifier: Topic :: Security :: Cryptography\r\nClassifier: Topic :: Software Development :: Libraries\r\nClassifier: License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication\r\nClassifier: Programming Language :: Python :: 3\r\nClassifier: Programming Language :: Python :: 3.4\r\nClassifier: Programming Language :: Python :: 3.5\r\nClassifier: Programming Language :: Python :: 3.6\r\nClassifier: Programming Language :: Python :: 3.7\r\nDescription-Content-Type: text/markdown\r\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/amaslyaev/random_xe_py", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "random-xe", "package_url": "https://pypi.org/project/random-xe/", "platform": "", "project_url": "https://pypi.org/project/random-xe/", "project_urls": { "Bug Reports": "https://github.com/amaslyaev/random_xe_py/issues", "Homepage": "https://github.com/amaslyaev/random_xe_py", "Source": "https://github.com/amaslyaev/random_xe_py" }, "release_url": "https://pypi.org/project/random-xe/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Random number generator with eXtra Entropy", "version": "1.0.0" }, "last_serial": 4262463, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "edecceed533aa03e42c6fc42eeca1977", "sha256": "edc0afe1ec38cd8d28052a2ae2977c4a786386cf5975ef80b8da4871a42b5ec6" }, "downloads": -1, "filename": "random_xe-1.0.0.tar.gz", "has_sig": false, "md5_digest": "edecceed533aa03e42c6fc42eeca1977", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5745, "upload_time": "2018-09-11T19:47:30", "url": "https://files.pythonhosted.org/packages/85/90/dc82a027817cd13a59c8b229f54651f9acf52ffd05f2d17fd6c623713793/random_xe-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "edecceed533aa03e42c6fc42eeca1977", "sha256": "edc0afe1ec38cd8d28052a2ae2977c4a786386cf5975ef80b8da4871a42b5ec6" }, "downloads": -1, "filename": "random_xe-1.0.0.tar.gz", "has_sig": false, "md5_digest": "edecceed533aa03e42c6fc42eeca1977", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5745, "upload_time": "2018-09-11T19:47:30", "url": "https://files.pythonhosted.org/packages/85/90/dc82a027817cd13a59c8b229f54651f9acf52ffd05f2d17fd6c623713793/random_xe-1.0.0.tar.gz" } ] }