stevegeek / encoded_id

Turn numeric or hex IDs into reversible and human friendly obfuscated strings
MIT License
8 stars 2 forks source link

V2, use Sqids instead of hashids? `https://github.com/sqids/sqids-ruby` #2

Open stevegeek opened 1 year ago

stevegeek commented 1 year ago

Sqids replace hashids , see https://sqids.org/ruby but are not backwards compatible

Upgrading to a v2 will require using a prefix on any new IDs to allow you to differentiate and if you have hash ID type ids in the wild, you will need to run both side by side and pick the right decoder... maybe the library can do this for you, ie be configured to support decoding older hashids (eg by identifying them someway, eg by format)

stevegeek commented 1 year ago

sqids says "...multiple IDs can decode back into the same sequence of numbers. If it's important to your design that IDs are canonical, you have to manually re-encode decoded numbers and check that the generated ID matches." .. is this true also of hashids?