We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Issue type: bug/documentation improvement
Only first x characters of a salt have effect on encoding result. It's undocumented and not clear whether it's a feature or a bug.
Following test is failing
@Test public void testSaltLenght() { int limit = 128; int minHashLength = 7; long input = 1; for (int i = 0; i < limit; i++) { String prefix = org.apache.commons.lang3.RandomStringUtils.randomAscii(i); Hashids h1 = new Hashids.Builder().minLength(minHashLength).salt(prefix + "A").build(); Hashids h2 = new Hashids.Builder().minLength(minHashLength).salt(prefix + "B").build(); String s1 = h1.encode(input); String s2 = h2.encode(input); assertThat("i: " + i + "; prfix: '" + prefix + "'", s1, is(not(equalTo(s2)))); } }
Test case above should not fail in case salt length is unlimited.
Test case fails usually around i = 45. Lowest I have seen is i = 32 which is likely related to randomly generated prefix value.
i = 45
i = 32
Input value looks to have effect too. When input = Hashids.MAX_INTEROP_NUMBER_SIZE test case fails usually when 41 < i < 44.
input = Hashids.MAX_INTEROP_NUMBER_SIZE
41 < i < 44
IceCore Hashids: 0.4.0 OS: MacOS 11.0.1 JDK: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10) Running in IDE and Gradle
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Metadata
Issue type: bug/documentation improvement
Description
Only first x characters of a salt have effect on encoding result. It's undocumented and not clear whether it's a feature or a bug.
Steps to Reproduce
Following test is failing
Expected Behavior
Test case above should not fail in case salt length is unlimited.
Actual Behavior
Test case fails usually around
i = 45
. Lowest I have seen isi = 32
which is likely related to randomly generated prefix value.Input value looks to have effect too. When
input = Hashids.MAX_INTEROP_NUMBER_SIZE
test case fails usually when41 < i < 44
.Example
Environment and Versions
IceCore Hashids: 0.4.0
OS: MacOS 11.0.1
JDK: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
Running in IDE and Gradle
The text was updated successfully, but these errors were encountered: