是否有任何通常被认为值得信赖的 SHA-256 javascript 实现? [英] Are there any SHA-256 javascript implementations that are generally considered trustworthy?

查看:21
本文介绍了是否有任何通常被认为值得信赖的 SHA-256 javascript 实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为论坛编写登录名,需要在将密码发送到服务器之前在 javascript 中散列客户端密码.我无法确定我真正可以信任的 SHA-256 实现.我期待有一种每个人都使用的权威脚本,但我发现很多不同的项目都有自己的实现.

I am writing a login for a forum, and need to hash the password client side in javascript before sending it on to the server. I'm having trouble figuring out which SHA-256 implementation I can actually trust. I was expecting there to be some kind of authoritative script that everyone used, but I'm finding loads of different projects all with their own implementations.

我意识到使用其他人的加密货币总是一种信念的飞跃,除非你有资格自己审查它,并且值得信赖"没有通用的定义,但这似乎是一件非常普遍和重要的事情,应该有对使用什么达成某种共识.是我太天真了吗?

I realize using other people's crypto is always a leap of faith unless you're qualified to review it yourself, and that there is no universal definition of "trustworthy", but this seems like something common and important enough that there ought to be some kind of consensus on what to use. Am I just naive?

编辑,因为它在评论中出现了很多:是的,我们再次在服务器端进行了更严格的散列.客户端散列不是我们保存在数据库中的最终结果.客户端散列是因为人类客户端请求它.他们没有给出具体原因,可能只是喜欢矫枉过正.

Edit since it comes up a lot in the comments: Yes, we do a more stringent hash again on the server side. The client side hashing is not the final result that we save in the database. The client side hashing is because the human client requests it. They have not given a specific reason why, probably they just like overkill.

推荐答案

过时: 许多现代浏览器现在都对加密操作提供一流的支持.请参阅下面的Vitaly Zdanevich 的回答.

OUTDATED: Many modern browsers now have first-class support for crypto operations. See Vitaly Zdanevich's answer below.

Stanford JS 加密库 包含 SHA-256 的实现.虽然 JS 中的加密并没有像其他实现平台那样经过严格审查,但这个平台至少部分由 Dan Boneh,他是密码学领域公认且值得信赖的名字,这意味着该项目受到了一些真正知道他在做什么的人的监督.该项目还得到 NSF 的支持.

The Stanford JS Crypto Library contains an implementation of SHA-256. While crypto in JS isn't really as well-vetted an endeavor as other implementation platforms, this one is at least partially developed by, and to a certain extent sponsored by, Dan Boneh, who is a well-established and trusted name in cryptography, and means that the project has some oversight by someone who actually knows what he's doing. The project is also supported by the NSF.

值得指出的是,但是...
...如果您在提交密码之前对客户端进行哈希处理,那么哈希就是密码,原始密码就变得无关紧要了.攻击者只需要拦截散列即可冒充用户,如果该散列未经修改地存储在服务器上,则服务器以明文形式存储真实密码(散列)-文本.

It's worth pointing out, however...
... that if you hash the password client-side before submitting it, then the hash is the password, and the original password becomes irrelevant. An attacker needs only to intercept the hash in order to impersonate the user, and if that hash is stored unmodified on the server, then the server is storing the true password (the hash) in plain-text.

所以您的安全性现在更糟,因为您决定添加您自己的改进以前是可信的方案.

So your security is now worse because you decided add your own improvements to what was previously a trusted scheme.

这篇关于是否有任何通常被认为值得信赖的 SHA-256 javascript 实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆