Skip to content

Decoding fails with custom separators #35

@cesarsouza

Description

@cesarsouza

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions