tzvetkoff / hashids.c

The C port of Hashids
MIT License
52 stars 24 forks source link

Introduce hashids_init4 to allow client to specify custom separators #30

Open okft opened 4 years ago

okft commented 4 years ago

It lets me using vowels as separators which is a better way to avoid slang words in French for intance.

okft commented 4 years ago

As requested, I updated the test suite (and found an error in my code), and the README file. I amended my first commit but when doing the rebase it seems git made another commit in-between.

Note that the last 4 tests are kind of broken with my custom separator set.

    {"", 1337, HASHIDS_DEFAULT_ALPHABET,
        "aeiouy",
        1, {1337ull},
        "...", __LINE__},

triggers a buffer overflow on my side

and

    {"", 22, "abdegjk0123456789",
        "aeiouy",
        1, {190126ull}, "070683k2j3771430j49157", __LINE__},
    {"\\7ULC'", 22, "@'l*p9n]);+7>Ar(\\",
        "aeiouy",
        1, {190126ull}, "9];r(An97\\]]\\()>7>\\)+]", __LINE__},

have the same result using HASHIDS_DEFAULT_SEPARATORS or my custom separators.