TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Abnormal String Hashing

52 点作者 r4um超过 5 年前

6 条评论

saagarjha超过 5 年前
If you&#x27;re curious on how to avoid this in your applications, take a look at universal hashing: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Universal_hashing" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Universal_hashing</a>
评论 #21197542 未加载
hinkley超过 5 年前
Do all of those lookup tables for powers of 31 work once integer overflow happens?
评论 #21201355 未加载
rurban超过 5 年前
He really didn&#x27;t understand Java&#x27;s take on this. Being zero-insensitive obviously is totally insecure. Java knew that. But Java decided to fight those kind of attacks better than most others. Java has a still trivial insecure hash function, which it decided to keep, because of an API blunder. But they convert the collisions from a linked list to a tree on too many collisions which indicate an active attack. Those attacks are rare, the common case is still fast.<p>Zero-insensitivity would have been fixable trivially, perl fixed that with 5.18, but they couldn&#x27;t, so they came up with a proper and much better fix. Unlike perl and everyone else.
评论 #21201886 未加载
hinkley超过 5 年前
I&#x27;m looking at all of the lookup tables in that code and wondering how much slower it would be to do a depth-first search and calculate as you went.<p>And then with a trie thrown in.
sorokod超过 5 年前
This is fun, but with the test code running 10 million iterations to generate &quot;slower&quot; numbers, is this of practical interest?
评论 #21199835 未加载
jepcommenter超过 5 年前
Arbitrary length string of null characters also produces zero hash, e.g.: System.out.println(&quot;\0\0\0\0\0&quot;.hashCode());