hashids / hashids.github.io

This is the old Hashids website. It is no longer maintained and has migrated over to Sqids.
https://sqids.org
206 stars 34 forks source link

hashids for mysql? #26

Closed siddo420 closed 8 years ago

siddo420 commented 8 years ago

Any plans to write functions for MySQL to en/decode hashids? This would make hashids more useful.

Ref: http://dev.mysql.com/doc/refman/5.7/en/adding-functions.html

jd327 commented 8 years ago

Right now there's only @waynebloss's implementation: https://github.com/waynebloss/hashids-tsql (I should probably link to it from the site as well). Can you describe your use-case a bit? I'm curious as to where it'd be beneficial to have purely SQL functions, as opposed to using existing libs.

ghost commented 8 years ago

The benefit for SQL Server is that I can generate the hash as part of the atomic INSERT statement, without making a separate trip to the database. So that's nice to have if you're using hashids heavily and creating hashes for many database rows.

Sorry I never finished the full hashids functionality there, but I didn't need decoding since the id is right next to the hash in every table.

jd327 commented 8 years ago

I see, that makes sense @waynebloss. I think I'll link to your lib from the site anyway so others can find it easier.

jd327 commented 8 years ago

Site updated: http://hashids.org/tsql