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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Don’t Hash Secrets

110 点作者 davidblair超过 15 年前

9 条评论

imurray超过 15 年前
The broader take home message of the article: "Don't invent security protocols (e.g., involving hashing) as there can be surprising weaknesses. Find a well-designed library routine that already does what you want."
评论 #1084907 未加载
评论 #1085062 未加载
cperciva超过 15 年前
Quoth the article:<p><i>That means that if you know SHA1(secret || message), then you can compute SHA1(secret || message || ANYTHING), which is a valid signature for message || ANYTHING. So to break this system, you just need to see one signature from SuperAnnoyingPoke, and then you can impersonate SuperAnnoyingPoke for lots of other messages.</i><p>This is absolutely incorrect. If you know SHA1(secret || message), you can compute SHA1(secret || message || padding || anything), which is quite a different matter. Most useful values of "anything" don't start with such padding.<p>Should anyone be designing a system which relies on this distinction for its security? Of course not. But things are bad enough already without exaggerating the scope of attacks.
评论 #1085251 未加载
antirez超过 15 年前
This is what you really want if you care a lot about avoiding the small domain problem (brute forcing H(myguess) so that I finally find H(myguess) == password_hash):<p>Just use an algorithm that is acceptably slow when used to authenticate users, but unacceptably slow when using for brute forcing.<p>For instance<p>HMAC(1,HMAC(2,HMAC(3,MAC(4,HMAC(..N,HMAC("yourPublicZZaaalt","yourpassword"))))))<p>Use N big enough so that you need a few milliseconds to run this code as optimized C.<p>If you are smart, design it so that CUDA wont help.<p>Now you are done. Brute forcing will take just too much if the password is not <i>too</i> obvious. It will be still possible to test 10000 hashes in a reasonable time maybe, but forget to run John The Ripper against it.
评论 #1085281 未加载
评论 #1085474 未加载
brettbender超过 15 年前
I feel like this should be titled "Don't hash secrets, unless you actually know what you are doing."
评论 #1084934 未加载
eplanit超过 15 年前
Hard to make it past 3 sentences of the arrogant writing style. Such arrogance usually indicates a lack of expertise. The substance of the article confirms that.<p>Yes, it's like "Don't Hash Unless You Really Understand That I'm the Only One Who Really Understands"
jf超过 15 年前
Another post on this topic, with links to research papers: <a href="http://rdist.root.org/2009/10/29/stop-using-unsafe-keyed-hashes-use-hmac/" rel="nofollow">http://rdist.root.org/2009/10/29/stop-using-unsafe-keyed-has...</a>
codahale超过 15 年前
Good god, no. Here is much better advice, in much shorter form:<p><i>If you're storing a password</i>, use bcrypt or I'll bite your thumbs off.<p><i>If you're making sure something hasn't been modified by someone and you absolutely can't use a signed GPG message</i>, use HMAC-SHA256 and a constant-time comparison algorithm or I'll bite your thumbs off.<p>All the business about hash functions is like advice on how to build your own car brakes using a backyard smelter and a sand cast. You might get something of roughly the right shape and weight but someone's going to get hurt down the road.
oozcitak超过 15 年前
Such articles leave me with the feeling that there are probably a couple hundred people on earth who truly understand cryptography. The rest of us either blindly follow them (good thing) or try to understand and apply the algorithms ourselves (very bad thing). I'd love to see some sort of crypto-recipes.org site: with a listing for use-cases, recipes underneath and implementations in different languages. I'm sure crypto experts will look down on this, but I believe it would greatly benefit the community.
nokya超过 15 年前
I disagree on that conception...somehow. Can someone explain? <a href="http://securecoding.ch/?p=201001290042267" rel="nofollow">http://securecoding.ch/?p=201001290042267</a>
评论 #1085417 未加载