{"repo":"iCyberon/pg_hashids","free":true,"listed":false,"github":"https://github.com/iCyberon/pg_hashids","clone":"git clone https://github.com/iCyberon/pg_hashids.git","description":"Short unique id generator for PostgreSQL, using hashids","language":"C","stars":323,"topics":["postgresql","database","hashids","postgres","pg-hashids","postgresql-extension"],"license":"MIT","category":"databases-storage","readme_excerpt":"pg hashids, generate short unique ids from integers ========================================= Hashids is a small open-source library that generates short, unique, non-sequential ids from numbers. It converts numbers like 347 into strings like “yr8”. You can also decode those ids back. This is useful in bundling several parameters into one or simply using them as short UIDs. You can use hashids to hide primary keys in your database. I've used the extension on several production databases. Tested PostgreSQL versions : 9.5.X and 9.6.X (Should work on older versions, just not tested) It's using hashids.c under the hood. More information about hashids and it's implementations here: hashids.org Installation ============ Make sure you have development packages installed for postgres and build tools in general. Then in a psql session issue: Update ============ Install as usual. Then in a psql session issue: or Check Tests ============ Usage ============ Encoding Returns a hash using the default alphabet and empty salt . Returns a hash using the default alphabet and supplied salt . Returns a hash using the default alphabet , salt and minimum hash length. Returns a hash using the supplied alphabet , salt and minimum hash length. Decoding You can also decode previously generated hashes. Just use the same salt , otherwise you'll get wrong results. Using a custom alphabet Decoding a single id You can also decode a previously generated hash into a single integer. Just use the same salt , o","default_branch":null,"files":null,"tree":[],"storefront":"/r/iCyberon","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/iCyberon/pg_hashids/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}