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.

“YOLO” is not a valid hash construction

140 pointsby ssklash9 months ago

10 comments

layer89 months ago
&gt; The issue we run into here is ambiguous encoding.<p>What I have done in the past for this is to encode the messages as UTF-8 and separate them by 0xFF, since that byte value never occurs in UTF-8 encoding [0]. If the messages to be hashed are character strings, you have to decide on <i>some</i> encoding anyway in order to hash them.<p>[0] UTF-8 bytes always contain at least one zero bit: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;UTF-8#Encoding" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;UTF-8#Encoding</a>. Incidentally, if one wanted to create the UTF-8 equivalent of zero-terminated strings without reserving a character value (like NUL) as the sentinel value, one could use 0xFF for that.
评论 #41342508 未加载
评论 #41344671 未加载
评论 #41342429 未加载
trainofbit9 months ago
The RFC recommendation for 1G RAM or 64MB Argon PKDF is insane. Don&#x27;t follow this advice. In a real world server, any API endpoint using this advice will quickly become a DOS vector. A saner value is 1MB for Argon. It stills blocks major GPU attacks, which is the whole point.
评论 #41341373 未加载
评论 #41342081 未加载
评论 #41346034 未加载
评论 #41356640 未加载
tptacek9 months ago
This is a good post, but there&#x27;s a little too much ritual in here about password-based KDFs for my taste. Put all the mainstream KDFs on a dartboard, yes including PBKDF2, and throw a dart. I think you&#x27;ll be fine. Bcrypt, the most popular password hash, has held up surprisingly well, and scrypt might still be one of the best options.
评论 #41342092 未加载
评论 #41341458 未加载
评论 #41341973 未加载
评论 #41342154 未加载
Dylan168079 months ago
&gt; While Keccak doesn’t suffer from the length-extension attacks that HMAC is meant to address, the phrase “simply prepending the message with the key” carries a lot of assumptions about key length and key formatting with it.<p>A <i>lot</i> of assumptions, or just that it&#x27;s fixed length?
评论 #41342116 未加载
blauditore9 months ago
I&#x27;m no expert and a bit tired, but: Is the problem around hashing password + salt for a key just about the fact it can be brute-forced with enough recources, or did I miss something?
评论 #41342756 未加载
hiddencost9 months ago
Oh fun. They actually give some erroneous advice.<p>Proto bufs don&#x27;t guarantee consistent serialization.
评论 #41344883 未加载
评论 #41344633 未加载
jgalt2129 months ago
At one point do I need to be concerned about this? i.e. have someone review hash generating code sites.<p>- 100s of hashes?<p>- 1000s of hashes?<p>- 1,000,000s of hashes?
theamk9 months ago
It&#x27;s interesting that using JSON encoding for all messages eliminates many of the problems.<p>ambiguous encoding? Nothing ambiguous about JSON, you don&#x27;t even need any separator. Or merge them into json array.<p>length-extension attacks? appending non-whitespace to json makes it invalid (for sane decoders at least)
评论 #41342311 未加载
krackers9 months ago
A cryptography course should be mandated in the curriculum of most universities, just so people gain some intuition about the types of attacks that are possible. Just yelling &quot;don&#x27;t roll your own crypto&quot; isn&#x27;t practical advice when most issues come from misusing primitives or combining primitives in a &quot;weak&quot; manner.
评论 #41342070 未加载
评论 #41344168 未加载
评论 #41341052 未加载
评论 #41341704 未加载
playingalong9 months ago
The article is not that different than &quot;don&#x27;t invent your own cryptography&quot;.<p>It&#x27;s hard to understand for non-crypto specialists. It uses notions which are unknown to most programmers like MAC or other *MACs.<p>So not sure who is the target audience for this.
评论 #41343464 未加载
评论 #41341127 未加载
评论 #41341176 未加载
评论 #41341482 未加载
评论 #41341803 未加载