Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicates found #20

Closed
doncadavona opened this issue Feb 12, 2025 · 1 comment
Closed

Duplicates found #20

doncadavona opened this issue Feb 12, 2025 · 1 comment

Comments

@doncadavona
Copy link

doncadavona commented Feb 12, 2025

Hi, I have found a duplicate using this alphabet:

KStk7TsjCQxpmvcDUnVe1Zi2gJlo3WqdPYw584BHXGrfR9MzAbaIuy60NhFELO

Using this set of alphabet, the integer 54 and 45 generates the same Sqids.
Image

See that regardless of minimum length, the Sqids are same for 54 and 45.
Image

Notice that UKkLWZg9DA duplicates are also generated using the default alphabet, with the numbers 63 and 123:
Image

Is this expected? What to do when we have duplicates? Am I to reshuffle the alphabet?

See it in https://sqids.org/playground.

Why is this an issue? Because the generated IDs are supposed to be unique, as said in FAQ:
https://sqids.org/faq#uniqueness
Image

@doncadavona doncadavona changed the title Duplicate found Duplicates found Feb 12, 2025
@doncadavona
Copy link
Author

I apologize, I didn't notice that the seemingly same IDs are actually unique by case:

Using the default alphabet, the IDs 63 and 123 generate the following strings, notice that they are not the same by case:

UkKLWZg9DA
UKkLWZg9DA

The problem I was having was that I was generating sqids for my existing MySQL table that was actually unique, but case-insensitive.

The solution to ensure that the unique table column is unique and case-sensitive.

@4kimov 4kimov closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants