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

Decoding fails with custom separators #35

Closed
cesarsouza opened this issue Jan 11, 2021 · 2 comments
Closed

Decoding fails with custom separators #35

cesarsouza opened this issue Jan 11, 2021 · 2 comments

Comments

@cesarsouza
Copy link

Please consider the example below. The only thing I've done was to remove the last letter ('U') from the separators used by default. After removing just this one letter, the decoding function will fail to decode the string and generates an empty array instead.

long[] input = new long[] { 1021432904621883393 };

Hashids target = new Hashids(seps: "cfhistCFHIST"); // default is "cfhistuCFHISTU"

// Encode
string hashid = target.EncodeLong(input); // hashid will be set to "uXGMvwPWDRuwv"

// Decode
long[] decoded = target.DecodeLong(hashid); // decoded will be set to an empty long[]

Assert.Equal(input, decoded); // fails
@cesarsouza
Copy link
Author

I've decided to change the sources myself and found out that the modifications proposed by @DwayneBull in #23 (comment) solved this issue.

@manigandham
Copy link
Collaborator

@cesarsouza

I've merged that fix and am working on other updates. We will have a new release soon. Closing this issue for now.

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