问题标签 [password-hash]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
879 浏览

c# - 加密函数中的解密方法

我有一种方法用于加密密码并将其存储到数据库中,如下所示:

现在我想要decrypt从数据库中获取的密码在存储时通过上述方法加密的方法。我不知道怎么做。任何人都可以帮助我吗?

0 投票
2 回答
1536 浏览

c# - C# 加密密码

我有一个用户的密码字段,当它保存到数据库时,密码是加密的。

另外,如果我去编辑一个用户,密码字段是散列的。

但是由于加密的长度,散列字段有数百个字符长。

有没有办法显示可能只有 8 个字符?

这是保存后显示的,不太理想。

加密

0 投票
1 回答
947 浏览

php - php中的密码加密,如web2py

我不会在 php 中实现在 web2py 中完成的密码哈希,现在我从 massimo de piero 创建的 web2py 中得到了一些关于如何做到这一点的说明,但我仍然无法在 php 中实现它,说明如下:

逻辑非常复杂,因为它需要处理许多选项并且不破坏向后兼容性。

通常哈希密码看起来像

算法$salt$hash 算法$$hash(无盐)hash(遗留)

哈希使用算法、盐和可选的用户提供的密钥进行计算。钥匙是独一无二的。每个密码的盐是不同的。

每次调用 CRYPT()('password') 时,都会得到一个 LazyCrypt 对象。该对象可以序列化为字符串。你得到的字符串总是不同的,因为它包含一个随机的盐。您无法比较其中两个字符串,因为即使密码相同,您也总是会得到错误。然而,您可以将 LazyObject 与字符串进行比较,并且惰性对象将使用相同的算法和字符串中的相同盐来计算哈希并将其与字符串中的哈希进行比较。例子:

以下是 web2py 框架中用于实现该加密的类:

希望有人能指导我一点,最好的问候,

0 投票
4 回答
2936 浏览

php - 这是 PHP 中一个很好的散列密码函数吗?如果不是,为什么不呢?

我想知道这个功能(部分取自大约 2 岁的 phpBB 版本)是否足够好。

如果不是,为什么?
你将如何改变它(使现有用户无缝过渡)?

hash_pwd() 的结果将保存在数据库中。

0 投票
2 回答
22897 浏览

php - PHP 最强单向加密/散列方法

我有一个人们可以注册的网站,我需要加密他们的密码。我已经对其进行了研究,但我找不到任何不会被现代 GPU 的强大功能击败的方法。

所以我来找 StackOverflow 的好人问,什么是最强大的加密方法,我已尽我所能阻止人们接触数据库,但我想尽可能确定他们的数据会是如果数据库以某种方式被盗,那很好。

我想知道的其他事情是,以某种方式随机化密码中的字符会更安全吗?

编辑: 我使用了 Andrew Moore 的 bcrypt 实现(How do you use bcrypt for hashing passwords in PHP?)并提出了这个:

如果有人看到它有任何问题或任何弱点,请告诉我。

0 投票
1 回答
4357 浏览

php - Crypt for password hashing. Blowfish produces weird output

I am having a bit little bit of trouble understanding php's crypt function. My PHP version is 5.4.7.

I want to use crypt to store salted passwords in the database, because as far as I am told, developers who use md5 to hash passwords are to be staked and burned on the spot.

I wanted to use the blowfish alg to generate the hash. Now, according to the php documentation, crypt uses blowfish if you call it with "$2y$" + cost (for instance: "08") + "$" + 22 characters salt ( ./0-9A-Za-z ). However, the output of this little bit of test code is confusing me:

Output:

The apparantly crypt fills the salt with $ if it is not long enough. The salt changes and so does the hash. So the output in line 1 and 2 are as expected.

What is puzzling me, however, are the last three hashes: Apparantly the dot seperates the hash from the salt (?) but if you actually give crypt the 22 characters it demands as salt, the dot vanishes. Also, the last character from the salt does not appear in the output, but changes the hash compared to the 21 character salt.

What is especially confusing is line 3 and 4 in the output! The salt is obviously different, but the hashes are exactly the same. I just cannot see any consistency in this and would greatly appreciate help.

0 投票
3 回答
777 浏览

php - 如何将登录脚本中的安全性从 MD5 更新为更安全的内容?

我在数据库上有一个带盐的 PHP 登录脚本,但在我的注册脚本中我看到:

和登录:

有没有可以代替MD5的代码?更安全的东西?

我听说过 SHA1 什么的。

0 投票
1 回答
91 浏览

php - 用于加密密码的 Salt 命令不起作用

对于我们的项目,我们正在尝试使用 salt 命令加密密码,但它似乎不起作用。这是我们目前所拥有的:

与 mysql 的连接正常,但显然有问题。密码变量是从另一个代码页发布的,该部分也可以正常工作。

0 投票
1 回答
2784 浏览

php - PHP 使用 password_hash 登录

以下代码不起作用:

登录页面:

用于插入数据库的代码:

谁能指出我做错了什么?

0 投票
1 回答
107 浏览

blowfish - “重新计算” SHA512+salt 字符串到 BLOWFISH+salt - 这可能吗?

也许这是一个愚蠢的问题,但如果一些优秀的大脑提出适当的解决方案或想法,我不会感到震惊:是否可以将盐渍 sha512 字符串重新计算/转码为盐渍河豚字符串

(imo 非常有趣)背景是:我有一个 SHA512+salt 字符串$6$rounds=5000$usesomesillystri$D4IrlXatmP7rx3P3InaxBeoomnAihCKREY4...(118 个字符)的大型数据库,并且想要移动到另一个哈希/盐算法,生成类似$2a$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi(60 个字符)的字符串。

我故意不在 security.stackexchange.com 上问这个问题,因为这不是一个安全问题。这是关于转码/重新计算。