TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How Hash Algorithms Work (2007)

175 pointsby jjoachim3over 8 years ago

15 comments

koolbaover 8 years ago
The first section is wrong (emphasis mine):<p>&gt; A hash function is simply an algorithm that takes a string of any length and reduces it to a <i>unique</i> fixed length string.<p>Hash functions strive for uniqueness but unless it&#x27;s precalculated to ensure that it&#x27;s true (by hashing every combination or deriving the parameters of the hash function accordingly), it&#x27;s not guaranteed. A <i>cryptographic</i> hash function gives a high probability of uniqueness but again it&#x27;s not guaranteed.<p>&gt; The word &#x27;cat&#x27; will hash to something that no other word hashes too, but it will always hash to the same thing.<p>Say I have a (terrible) hash function H(X) =&gt; 1. Now &quot;cat&quot; will hash to the same value as the string &quot;<i>I don&#x27;t understand hash functions</i>&quot;.
评论 #13392963 未加载
评论 #13392915 未加载
评论 #13391670 未加载
rkdaover 8 years ago
&gt;The word &#x27;cat&#x27; will hash to something that no other word hashes too, but it will always hash to the same thing.<p>Don&#x27;t hashing functions have collisions?
评论 #13390160 未加载
评论 #13389984 未加载
评论 #13390058 未加载
评论 #13390702 未加载
评论 #13390018 未加载
stygiansonicover 8 years ago
This is really a walk through of the SHA-1 algorithm.<p>It&#x27;s also worthwhile to note that the statement that a hash takes a string and reduces it to a fixed length string is a little misleading. They really work at the binary level and this is seen in the example where the input is converted to binary assuming ASCII and the output hex encoded.
评论 #13392543 未加载
评论 #13391193 未加载
jdwyahover 8 years ago
&quot;A Comprehensive and fundamentally innacurate guide&quot;<p>Saying they&#x27;re unique is just very very wrong.
评论 #13391838 未加载
mbelover 8 years ago
The title probably should be &#x27;Cryptographic Hash Algorithms&#x27;. The definitions from the post are approximately true for cryptographic hashes but not really for hash functions in general.
评论 #13390859 未加载
评论 #13390619 未加载
DanBCover 8 years ago
It&#x27;s a nice article, although they probably need to say that they&#x27;re talking about cryptographic hashes earlier on, at least mention that some hashes are very easy to find collisions with.
tannrangerover 8 years ago
So there&#x27;s a lot of talk about how encryption algorithms relying on the difficulty of factoring primes could be weakened by quantum computers in the near future.<p>Are there any technological advances or scenarios where the security of hash algorithms could be weakened (other than computers just getting fasters via ~Moore&#x27;s Law).
评论 #13393959 未加载
Curious42over 8 years ago
As someone extremely new to this; can this procedure be worked backwards to retrieve the original text? If no, why not?
评论 #13390300 未加载
评论 #13390381 未加载
评论 #13390268 未加载
评论 #13390281 未加载
评论 #13392712 未加载
评论 #13390285 未加载
bogomipzover 8 years ago
I have a question about Step 5 in the post, it states:<p>Is &quot;Step 5: Add &#x27;1&#x27; to the end&quot;<p>Is this a delimiter for beginning of the padding or does it server some other purpose?
natchover 8 years ago
&gt;Finally, if I were to give you only &#x27;a94a8fe5ccb19ba61c4c0873d391e987982fbbd3&#x27; and tell you that it came from the SHA-1, you should have absolutely no way to figure out what was put into the function to create that.<p>add a &quot;rainbow tables&quot; caveat to that.
tomlxover 8 years ago
Title is missleading. From the title I expected something about how to design a hash algorithm, but the article is just a walk through the specific operations SHA-1 performs w&#x2F;o further explanation.<p>Can anyone recommand resources about the actual design of (cryptographic) hash algorithms?
Zashover 8 years ago
A hash function takes variable length input and returns a fixed length output, that&#x27;s all. Then there are sub-categories optimized for things like use in hash tables or building blocks in crypto, all with varying emphasis on uniqueness, output size and speed.
libruaryover 8 years ago
Would someone be able to ELI5 step 6 for me? I don&#x27;t understand the math needed in order to determine that 399 zeros needed to be added.
评论 #13392913 未加载
glidekover 8 years ago
What is the name of the hashing algorithm broken down in the article?
zebra1832over 8 years ago
Title is very misleading. Only one hash function is presented. Afaict the presented hashing function is not even named. Is it SHA1? No motivation is given, just (pseudo)code.