Comments (3)
Ok, some learnings:
- append/prepend of a per-map seed does not help with std JDK hashCode() (or its variations), since they fundamentally prone to cheap substring-concatenation style generation of collisions.
- length() won't either, as substring-based strings can have same length as well.
Some remaining practical alternatives include:
- Use same hash code algo as Perl, which uses shifting; downside is that this is rather slow (twice as slow) -- however, while this is true for stand-alone calculation, it might not be measurable in big picture.
- Use Adler-32 variation: this would be much faster (in fact, even marginally faster than original hashCode()!); but I need to verify that it can benefit from seed
In both cases it is important to note that per-Map seed value should make it impractical to pre-calculate collisions.
from jackson-core.
With some testing, found out that Adler-32 is not (alas!) a good alternative; number of collisions is surprisingly high.
So: with that, changes to make will be:
- For byte-based variant, add shifting, make less linear; should pretty much fix the problem
- For char-based variant, add post-shuffling, use better multiplier. Will NOT fix substring problem, just improves non-malevolent cases
- For both, add checking so that if max-collisions-length exceeds, exception thrown: assumption being that collisions may be still calculatable.
NOTE: this does NOT fix potential issue with ObjectNode
; that is covered by another Issue.
from jackson-core.
On versions: fixes included in upcoming releases:
- 1.9.9 for 1.x series (not backported as previous branches are closed)
- 2.0.5 for 2.0; and 2.1.0 when 2.1 gets released.
from jackson-core.
Related Issues (20)
- Add char[] versions for NumberInput parseFloat, parseDouble, parseBigInteger HOT 17
- Enable Fast Floating-Point reading/writing by default in 3.0
- Lower default `maxNestingDepth` of `StreamReadConstraints` / `StreamWriteConstraints` to 500 in 3.0
- Migrate remaining test to JUnit 5 HOT 3
- document JsonRecyclerPools.sharedBoundedPool() HOT 1
- NoSuchMethodError: com.fasterxml.jackson.core.util.BufferRecycler.releaseToPool() HOT 3
- Revert #1117: change default recycler pool back to `threadLocalPool()` for 2.17.1 HOT 1
- Figure out why `LockFreePool` appears to cause unintended object retention (~= memory leak) HOT 13
- Add diagnostic method `pooledCount()` in `RecyclerPool` HOT 1
- Rename shaded `ch.randelshofer:fastdoubleparser` classes to prevent use by downstream consumers HOT 3
- Change default recycler pool to `bewConcurrentDequePool()` in 2.18
- Change `JsonFactory.builder()` configuration of `RecyclerPool` to avoid allocation default implementation (in 3.0)
- Deprecate `LockFreePool` implementation in 2.18 (remove from 3.0) HOT 3
- Locale deserialization fails on locales with only a language and variant HOT 2
- `NUL`-corrupted keys, values on JSON serialization HOT 5
- Add back Java 22 optimisation in FastDoubleParser HOT 1
- Optimize `JsonParser.getDoubleValue()/getFloatValue()/getDecimalValue()` to avoid String allocation
- jackson-core-2.16.0.jar incorrectly flagged with CVE-2023-5072 (org.json library issue) HOT 3
- Add new method like `JsonParser.readText(Writer)` (and implementation) for truly non-buffering reads
- NegativeArraySizeException and ArrayIndexOutOfBoundsException in ByteQuadsCanonicalizer HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jackson-core.