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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

The many flavors of hashing

100 点作者 ciprian_craciun将近 3 年前

6 条评论

Sniffnoy将近 3 年前
Since the OP is the author, I have to point out the following mistake:<p>&gt; Related to the &quot;looks random enough&quot; aspect, because the input size is almost always larger than the output (which is fixed size), there are usually an infinite number of inputs for which the output is the same, thus these functions are not surjective.<p>The word you are looking for here is &quot;injective&quot;, not &quot;surjective&quot;.<p>Edit: As long as I&#x27;m pointing out wrong-word errors like this, I should probably also point out that the phrase is &quot;bear with me&quot;, not &quot;bare with me&quot;.
评论 #32303599 未加载
评论 #32301547 未加载
评论 #32302285 未加载
tptacek将近 3 年前
This article dances around the problem of encrypting small values a bunch. Here&#x27;s a Rogaway paper on how to do it:<p><a href="https:&#x2F;&#x2F;www.cs.ucdavis.edu&#x2F;~rogaway&#x2F;papers&#x2F;thorp.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.ucdavis.edu&#x2F;~rogaway&#x2F;papers&#x2F;thorp.pdf</a><p>(You do not need to limit yourself to inputs that are multiples of the AES block size).<p>There&#x27;s another one like this, I forget the name.<p>SHA-2 is just fine, and is usually a saner choice than SHA-3 (if you want to be a crypto-hipster, use Blake2, not SHA-3; it&#x27;s usually an easier dep to pull in, and more things use it).
zeroimpl将近 3 年前
The section about signature hashes could use some improvement. Cryptographic hashes have multiple use cases. The main one that comes to mind is basically just secure checksum&#x2F;integrity hashes where you want to guarantee nobody could force a collision. For this case, all the scary warnings about &quot;don&#x27;t use these algorithms directly&quot; makes no sense.
评论 #32302483 未加载
a_e_k将近 3 年前
I once had a need for permutation hashing as part of a 2D sampling algorithm. My approach was to compose the hash using only reversible steps (to ensure that it&#x27;s a permutation), and then use cycle walking to reduce the domain size from a power-of-two down to an arbitrary non-power-of-two size if needed.<p>I published my implementation in the Pseudorandom Permutations section of my &quot;Correlated Multi-Jittered Sampling&quot; tech report: <a href="https:&#x2F;&#x2F;graphics.pixar.com&#x2F;library&#x2F;MultiJitteredSampling&#x2F;paper.pdf" rel="nofollow">https:&#x2F;&#x2F;graphics.pixar.com&#x2F;library&#x2F;MultiJitteredSampling&#x2F;pap...</a>
评论 #32303132 未加载
rurban将近 3 年前
Thanks for the nice words!
xzghfat将近 3 年前
i like it