{ "info": { "author": "Ivan Skorokhodov", "author_email": "iskorokhodov@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "hasheroku\n============\n\nTraditional hashing seems boring and mundane?\nCan't bear the heartlessness of their musty hex strings?\nPut down the razor: we have something for you.\n\n.. code:: python\n\n hasheroku('Hashing goes bananas!') # -> 'throbbing-mountain'\n hasheroku('Hashing goes bananas.') # -> 'summer-frost'\n hasheroku('Hasheroku goes bananas!') # -> 'withered-star'\n hasheroku('Everything goes bananas!') # -> 'icy-thunder'\n\n:code:`hasheroku` hashes strings into nice hashes, using heroku naming conventions.\nIt's like a heroku random names `generator`_, but hashing function!\n\n**DISCLAIMER**: There are only 64x64 = 4096 unique combinations of heroku names, so *there will be a whole lot of collisions*.\nThat's why never use bare heroku hashes (i.e. without hex suffixes \u2014 explained `below`_) in the situations, where you are going to generate a lot of hashes!\n\n.. _generator : https://github.com/usmanbashir/haikunator\n.. _below : https://github.com/universome/hasheroku#usage\n\nInstallation\n============\nYou can install :code:`hasheroku` using :code:`pip`:\n\n.. code:: bash\n\n pip install hasheroku\n\nUsage\n============\nIf you are not going to hash a lot of strings and/or do not care about collisions, than you can use it in a standard way:\n\n.. code:: python\n\n hasheroku('I love hashes!') # -> 'old-fiesta'\n\nYou can use your own separator with :code:`separator` argument:\n\n.. code:: python\n\n hasheroku('I love hashes!', separator='~') # -> 'old~fiesta'\n hasheroku('Maaan, who does not like hashes?!', ' ') # -> 'lingering shadow'\n\nIf you are really serious and responsible about your hashing and would like to avoid collisions, then you can append part of the hash from the :code:`sha256` digest to the produced heroku hash.\nThis can be done with an optional :code:`suffix_len` argument:\n\n.. code:: python\n\n hasheroku('I love hashes!', suffix_len=5) # -> 'old-fiesta-cd298'\n hasheroku('I love hashes!', 10, '~') # -> 'old~fiesta~cd29895f2a'\n hasheroku('Maaan, who does not like hashes?!', 30, ' ') # -> 'lingering shadow a7c1c6cd56a755c3e87d9b667ef9dd'\n\nIn this case, of course, you lose all the awesomeness of human-readable hashes and can just use traditional hashing functions.\n\nAre all names equally likely to be generated?\n============\nYes. First, we get sha256 hash of the string, than we project its first 4 hexadecimal characters into heroku adjectives and names.\nAs long as these 4 characters are uniformly distributed (and they do) and we project them properly (and we do) \u2014 our hashes are uniformly distributed too.\nThe problem, of course, is with the tiny amount of possible names, that's why we have a lot of collisions.\n\nMan, why?\n============\nThis project can be useful when you regurarly deploy services/run experiments and want their names to be a hash of their config file.\nUsing traditional hashing like md5/sha256 makes the names look ugly and their large entropy is not needed at all in such a case.\n\nContributing and TODOs\n============\n\n.. |ss| raw:: html\n\n \n\n.. |se| raw:: html\n\n \n\nIf you feel like you have nothing else to do with your life, you can contribute to this project.\nIt will be cool to make the following things:\n\n* Write a proper test for uniformity. There is a Kolmogorov-Smirnov test to check if a random variable is uniform, but it works only with continuous variables. And I do not know how to check the same thing for discrete ones (friendly, I didn't google this much, because I was a little bit |ss| lazy |se| busy).\n* Add more names and adjectives. This will allow us to reduce amount of collisions. Currently, I've hardcoded usage of only 64 adjectives/names. To sample properly I suppose we should take binary digest of the sha256 and use `this`_.\n\n.. _this : https://stats.stackexchange.com/questions/70073/generating-discrete-uniform-from-coin-flips", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/universome/hasheroku", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "hasheroku", "package_url": "https://pypi.org/project/hasheroku/", "platform": "", "project_url": "https://pypi.org/project/hasheroku/", "project_urls": { "Homepage": "https://github.com/universome/hasheroku" }, "release_url": "https://pypi.org/project/hasheroku/0.1.2/", "requires_dist": null, "requires_python": ">=3", "summary": "Generates nice heroku-ish hash from the string", "version": "0.1.2" }, "last_serial": 3964409, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "418fc061801c00d81ba61fc728cf46c1", "sha256": "f477ced34f0a6c8bd709a30b418fa9ceee0f25ec3daf560811af2c35dea9d791" }, "downloads": -1, "filename": "hasheroku-0.0.1-py3.6.egg", "has_sig": false, "md5_digest": "418fc061801c00d81ba61fc728cf46c1", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": ">=3", "size": 9735, "upload_time": "2018-06-15T11:34:56", "url": "https://files.pythonhosted.org/packages/57/01/be0eebb5f4adb5a8d3f117b909771d00dcbabfaec4ed6200cb178245d759/hasheroku-0.0.1-py3.6.egg" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "42841142caff8ce197de013bcd968290", "sha256": "e0ef75b81a9873f2b47416406c6b0efe83ba7d23574513fa6a6d32bd74cca4a9" }, "downloads": -1, "filename": "hasheroku-0.1.2.tar.gz", "has_sig": false, "md5_digest": "42841142caff8ce197de013bcd968290", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 5089, "upload_time": "2018-03-23T20:58:03", "url": "https://files.pythonhosted.org/packages/8c/b6/179db347bacfe92e0e0990ff4b66628b9c765c7e07005558843b1dfa23d8/hasheroku-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "42841142caff8ce197de013bcd968290", "sha256": "e0ef75b81a9873f2b47416406c6b0efe83ba7d23574513fa6a6d32bd74cca4a9" }, "downloads": -1, "filename": "hasheroku-0.1.2.tar.gz", "has_sig": false, "md5_digest": "42841142caff8ce197de013bcd968290", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 5089, "upload_time": "2018-03-23T20:58:03", "url": "https://files.pythonhosted.org/packages/8c/b6/179db347bacfe92e0e0990ff4b66628b9c765c7e07005558843b1dfa23d8/hasheroku-0.1.2.tar.gz" } ] }