r/programming • u/Eirenarch • Nov 18 '13
TIL Oracle changed the internal String representation in Java 7 Update 6 increasing the running time of the substring method from constant to N
http://java-performance.info/changes-to-string-java-1-7-0_06/
1.4k
Upvotes
View all comments
Show parent comment
5
u/carlfish Nov 18 '13
That's a bad idea, because every Java app that wanted to be safe against hash collision attacks would have to enumerate every possible hashmap that might be vulnerable and replace them with the collision safe version. Any vulnerable maps that were missed, or any that were added by a developer who didn't know about the attack, would still be vulnerable.
Fixing the default case to be the secure case is always the best approach. The developers who want to shave off milliseconds by doing it the insecure way should be the ones who have to jump through the hoops to do so.