{ "info": { "author": "David Aurelio", "author_email": "dev@david-aurelio.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "========================\nhashids for Python 2.6\u20133\n========================\n\nA python port of the JavaScript *hashids* implementation. It generates YouTube-like hashes from one or many numbers. Use hashids when you do not want to expose your database ids to the user. Website: http://www.hashids.org/\n\nCompatibility\n=============\n\nhashids is tested with python 2.6, 2.7, 3.2, 3.3 and 3.4. PyPy and PyPy 3 work as well.\n\n.. image:: https://travis-ci.org/davidaurelio/hashids-python.svg?branch=master\n :target: https://travis-ci.org/davidaurelio/hashids-python\n\nCompatibility with the JavaScript implementation\n------------------------------------------------\n\n================== ==============\nhashids/JavaScript hashids/Python\n------------------ --------------\nv0.1.x v0.8.x\nv0.3.x and v1.0.x v1.0.2+\n================== ==============\n\nThe JavaScript implementation produces different hashes in versions 0.1.x and 0.3.x. For compatibility with the older 0.1.x version install hashids 0.8.4 from pip, otherwise the newest hashids.\n\n\nInstallation\n============\n\nInstall the module from PyPI, e.\u00a0g. with pip:\n\n.. code:: bash\n\n pip install hashids\n pip install hashids==0.8.4 # for compatibility with hashids.js 0.1.x\n\nRun the tests\n=============\n\nThe tests are written with `pytest `_. The pytest module has to be installed.\n\n.. code:: bash\n\n python -m pytest\n\nUsage\n=====\n\nImport the constructor from the ``hashids`` module:\n\n.. code:: python\n\n from hashids import Hashids\n hashids = Hashids()\n\nBasic Usage\n-----------\n\nEncode a single integer:\n\n.. code:: python\n\n hashid = hashids.encode(123) # 'Mj3'\n\nDecode a hash:\n\n.. code:: python\n\n ints = hashids.decode('xoz') # (456,)\n\nTo encode several integers, pass them all at once:\n\n.. code:: python\n\n hashid = hashids.encode(123, 456, 789) # 'El3fkRIo3'\n\nDecoding is done the same way:\n\n.. code:: python\n\n ints = hashids.decode('1B8UvJfXm') # (517, 729, 185)\n\nUsing A Custom Salt\n-------------------\n\nHashids supports salting hashes by accepting a salt value. If you don\u2019t want others to decode your hashes, provide a unique string to the constructor.\n\n.. code:: python\n\n hashids = Hashids(salt='this is my salt 1')\n hashid = hashids.encode(123) # 'nVB'\n\nThe generated hash changes whenever the salt is changed:\n\n.. code:: python\n\n hashids = Hashids(salt='this is my salt 2')\n hashid = hashids.encode(123) # 'ojK'\n\nA salt string between 6 and 32 characters provides decent randomization.\n\nControlling Hash Length\n-----------------------\n\nBy default, hashes are going to be the shortest possible. One reason you might want to increase the hash length is to obfuscate how large the integer behind the hash is.\n\nThis is done by passing the minimum hash length to the constructor. Hashes are padded with extra characters to make them seem longer.\n\n.. code:: python\n\n hashids = Hashids(min_length=16)\n hashid = hashids.encode(1) # '4q2VolejRejNmGQB'\n\nUsing A Custom Alphabet\n-----------------------\n\nIt\u2019s possible to set a custom alphabet for your hashes. The default alphabet is ``'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'``.\n\nTo have only lowercase letters in your hashes, pass in the following custom alphabet:\n\n.. code:: python\n\n hashids = Hashids(alphabet='abcdefghijklmnopqrstuvwxyz')\n hashid = hashids.encode(123456789) # 'kekmyzyk'\n\nA custom alphabet must contain at least 16 characters.\n\nRandomness\n==========\n\nThe primary purpose of hashids is to obfuscate ids. It's not meant or tested to be used for security purposes or compression. Having said that, this algorithm does try to make these hashes unguessable and unpredictable:\n\nRepeating numbers\n-----------------\n\nThere are no repeating patterns that might show that there are 4 identical numbers in the hash:\n\n.. code:: python\n\n hashids = Hashids(\"this is my salt\")\n hashids.encode(5, 5, 5, 5) # '1Wc8cwcE'\n\nThe same is valid for incremented numbers:\n\n.. code:: python\n\n hashids.encode(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) # 'kRHnurhptKcjIDTWC3sx'\n\n hashids.encode(1) # 'NV'\n hashids.encode(2) # '6m'\n hashids.encode(3) # 'yD'\n hashids.encode(4) # '2l'\n hashids.encode(5) # 'rD'\n\nCurses! #$%@\n============\n\nThis code was written with the intent of placing generated hashes in visible places \u2013 like the URL. Which makes it unfortunate if generated hashes accidentally formed a bad word.\n\nTherefore, the algorithm tries to avoid generating most common English curse words by never placing the following letters next to each other: **c, C, s, S, f, F, h, H, u, U, i, I, t, T.**\n\nLicense\n=======\n\nMIT license, see the LICENSE file. You can use hashids in open source projects and commercial products.\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/davidaurelio/hashids-python", "keywords": "", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "hashids", "package_url": "https://pypi.org/project/hashids/", "platform": "", "project_url": "https://pypi.org/project/hashids/", "project_urls": { "Homepage": "https://github.com/davidaurelio/hashids-python" }, "release_url": "https://pypi.org/project/hashids/1.2.0/", "requires_dist": null, "requires_python": "", "summary": "Python implementation of hashids (http://www.hashids.org).Compatible with python 2.6-3.", "version": "1.2.0" }, "last_serial": 2558663, "releases": { "0.8.3": [ { "comment_text": "", "digests": { "md5": "1f1da1ca12b37aa6c3e3119b504d7e8a", "sha256": "93aa48138f73ed3f0bf083215e08510e73d4be03021ed9822ab1c822d75da1a2" }, "downloads": -1, "filename": "hashids-0.8.3.tar.gz", "has_sig": false, "md5_digest": "1f1da1ca12b37aa6c3e3119b504d7e8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5934, "upload_time": "2013-06-02T21:32:10", "url": "https://files.pythonhosted.org/packages/c9/fc/aa475ade8f898fd4e33f00af9799d6991f0db686c0feddd6db96ffa4a443/hashids-0.8.3.tar.gz" } ], "0.8.4": [ { "comment_text": "", "digests": { "md5": "fd4daf5ec86813910d385daec602d6ec", "sha256": "91d739af583167adb78a7b0af5befa3f4c76d5e1babed80cd6e63e2037a7c6ea" }, "downloads": -1, "filename": "hashids-0.8.4.tar.gz", "has_sig": false, "md5_digest": "fd4daf5ec86813910d385daec602d6ec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5917, "upload_time": "2014-02-04T12:29:57", "url": "https://files.pythonhosted.org/packages/cb/e3/937318851c2bc45a67d1d9b29ccb04f95b0f7230a8fc8e2e5eca40791c70/hashids-0.8.4.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "b62d687128e048edd39506f21b0ff3cb", "sha256": "cc3d70e9415d1862f6419661e6eeeefdae6c1a16fc5b1984350cc696b15b657a" }, "downloads": -1, "filename": "hashids-1.0.0.tar.gz", "has_sig": false, "md5_digest": "b62d687128e048edd39506f21b0ff3cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6887, "upload_time": "2014-04-21T21:28:18", "url": "https://files.pythonhosted.org/packages/db/37/4acf93268963e8fd063904cf3355ed558b7ba35e70d244e053a56a0e0e85/hashids-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "6a41dd7c7c32c029fe97f9de6eebd5e3", "sha256": "871430a72070620ebbe6a463bb999ac8726d9d719517f54cc67426147b49e1c1" }, "downloads": -1, "filename": "hashids-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6a41dd7c7c32c029fe97f9de6eebd5e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6952, "upload_time": "2014-06-19T13:39:04", "url": "https://files.pythonhosted.org/packages/f3/ae/e8d2045a6133a2b1e4264002e4d1bea4099f020d08d4e47b83f58eaca5ee/hashids-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "9958db407e7350242e9c3c4cb4225d58", "sha256": "e09752342b7108cc1a41e3ca18a616666caf9ed459d1cb9ada607ae9d7f0f546" }, "downloads": -1, "filename": "hashids-1.0.2.tar.gz", "has_sig": false, "md5_digest": "9958db407e7350242e9c3c4cb4225d58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8020, "upload_time": "2015-01-15T00:51:06", "url": "https://files.pythonhosted.org/packages/2b/23/b7fec05542f0a58c9da572269a23fb910ad734ec3e14fc7e85dc8d48e295/hashids-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "73e30642e5202c6f848b168310541c35", "sha256": "94fd54cc286b490a688275af14ed4aa0187dc5e7110ba4148fd3cbe8408df548" }, "downloads": -1, "filename": "hashids-1.0.3.tar.gz", "has_sig": false, "md5_digest": "73e30642e5202c6f848b168310541c35", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7583, "upload_time": "2015-02-26T23:05:04", "url": "https://files.pythonhosted.org/packages/70/fb/b8babba4e660cd706f1a609bd20feb81c4437b2d8489b8b1cbc0d9c453af/hashids-1.0.3.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "2cdf33156982f3fb591e56844bb691d9", "sha256": "bf20ab4cb7ef3b171e348e6847ac55a6bab903e8675749ea9f3de26e43705e35" }, "downloads": -1, "filename": "hashids-1.1.0.tar.gz", "has_sig": false, "md5_digest": "2cdf33156982f3fb591e56844bb691d9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8384, "upload_time": "2015-03-31T20:49:58", "url": "https://files.pythonhosted.org/packages/54/61/13eb004f42cec321bbfb885cd0a2b298e4e5294f2f0e5244684cb2c247ec/hashids-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "f4d8481245aaa470e0c594eeb691a4c8", "sha256": "6539b892a426e75747a9c0ad69409e9566f9c21b79310fc3424b5b6726f28da6" }, "downloads": -1, "filename": "hashids-1.2.0.tar.gz", "has_sig": false, "md5_digest": "f4d8481245aaa470e0c594eeb691a4c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8512, "upload_time": "2017-01-06T23:00:27", "url": "https://files.pythonhosted.org/packages/02/d3/0191ddd06cace1873f237f134a357d8af84c0ed3740526f4946ddbfaeed6/hashids-1.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f4d8481245aaa470e0c594eeb691a4c8", "sha256": "6539b892a426e75747a9c0ad69409e9566f9c21b79310fc3424b5b6726f28da6" }, "downloads": -1, "filename": "hashids-1.2.0.tar.gz", "has_sig": false, "md5_digest": "f4d8481245aaa470e0c594eeb691a4c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8512, "upload_time": "2017-01-06T23:00:27", "url": "https://files.pythonhosted.org/packages/02/d3/0191ddd06cace1873f237f134a357d8af84c0ed3740526f4946ddbfaeed6/hashids-1.2.0.tar.gz" } ] }