{ "info": { "author": "Asher Blum", "author_email": "asher@wildsparx.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Other Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Database", "Topic :: Security :: Cryptography", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: General" ], "description": "Introduction\n============\n\nidgen lets you generate unique identifiers that:\n\n * match a desired format;\n * look random (if you activate crypto);\n * can be converted back to ints, given the password; and\n * use ALL possible values in the forma\n\nLet's say you want to generate IDs like::\n\n vis90000\n suu54581\n qcr00006\n pcg75148\n yuy22283\n low69877\n\nFeed the numbers 0-5 thru ``Encoder('aaaddddd', password='jupiterx')``.\n\nYou can reverse the process, turning these ids back into 0-5.\n\nQuestions\n=========\n\n**Q:** Why not use incrementing integers as identifiers?\n\n**A:** You may want to conceal from outsiders how rapidly objects\nare being created. You may want specific formats that use less\ncharacters than base10 but are human-friendly.\n\n**Q:** Why not randomly generate identifiers?\n\n**A:** If you want to avoid issuing the same id twice, you need to look\nup each new id in a database or map. As the number of issued ids\ngrows, the number of lookups per new id grows. If you only plan\nto use a tiny portion of the available keyspace, this is acceptable,\nbut inelegant compared to just encrypting an int.\n\n**Q:** Why not just encrypt an integer with AES or something?\n\n**A:** Because the output of the block cipher is a fixed size, which\nis not likely to match your desired format.\n\nA format of digits and uppercase letters, for instance, has 10**A * 26**B values.\n\nThe 128-bit outputs of AES would take 39 decimal digits to encode.\n\nIf you truncate the output of the block cipher, the ids are no longer\nunique or reversible.\n\n\n\n\nInstallation\n============\n\nCheckout the source and run ``python setup.py install``.\n\nUsing Idgen\n===========\n\n::\n\n from idgen import Encoder\n enc = Encoder('adad', password='Jupiterx')\n id = enc.encode(13) # f6d9\n i = enc.decode(id) # 13\n\nThis creates an encoder which encodes/decodes strings of the form\nletter-digit-letter-digit. There are ``26*10*26*10`` such strings,\nso the encoder can handle integers from 0 to n-1.\n\nUsing Different Character Sets\n------------------------------\n\n::\n\n enc = Encoder('wpwpw', types={'w': 'VWXYZ', 'p': '!@#$%^&*()'}, password='Jupitery')\n for i in range(5):\n print enc.encode(i)\n\nProduces::\n\n X$X&X\n Y%W(W\n V!W$V\n Z)V@Y\n V)X)X\n\nEncoding Without Encryption\n---------------------------\n\nIf you just want to convert between integers and some alphanumeric\nrepresentation::\n\n enc = Encoder('aaa')\n for i in range(200, 205):\n print enc.encode(i)\n\nProduces::\n\n ahs\n aht\n ahu\n ahv\n ahw\n\nInserting Constant Characters (Punctuation)\n-------------------------------------------\n\n::\n\n enc = Encoder('ad/ddd-a.d', password='Jupiterz')\n for i in range(5):\n print enc.encode(i)\n\nProduces::\n\n j7/739-l.5\n x2/319-z.2\n w9/274-i.8\n z5/166-m.9\n v3/500-p.3\n\n\nIdgen treated the punctuation characters as constant because they\nare not keys in the *types* map.", "description_content_type": null, "docs_url": null, "download_url": "http://wildsparx.com/idgen/idgen-0.0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://wildsparx.com/idgen/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "idgen", "package_url": "https://pypi.org/project/idgen/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/idgen/", "project_urls": { "Download": "http://wildsparx.com/idgen/idgen-0.0.1.tar.gz", "Homepage": "http://wildsparx.com/idgen/" }, "release_url": "https://pypi.org/project/idgen/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Generate encrypted identifiers", "version": "0.0.1" }, "last_serial": 803019, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "f955e2b7b83473eadc10f74a3444a69b", "sha256": "5a1a4a4ae8a72773542118eeb6ea4ccfce82101294c6ab2410ad06c5232a561f" }, "downloads": -1, "filename": "idgen-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f955e2b7b83473eadc10f74a3444a69b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4148, "upload_time": "2011-11-17T18:28:57", "url": "https://files.pythonhosted.org/packages/d2/c6/d5cd121f50b4b62bd7e78cd316a61a1cdbe163c091adeb63c0907b25dbd8/idgen-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f955e2b7b83473eadc10f74a3444a69b", "sha256": "5a1a4a4ae8a72773542118eeb6ea4ccfce82101294c6ab2410ad06c5232a561f" }, "downloads": -1, "filename": "idgen-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f955e2b7b83473eadc10f74a3444a69b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4148, "upload_time": "2011-11-17T18:28:57", "url": "https://files.pythonhosted.org/packages/d2/c6/d5cd121f50b4b62bd7e78cd316a61a1cdbe163c091adeb63c0907b25dbd8/idgen-0.0.1.tar.gz" } ] }