简体   繁体   English

如何使用Salt和Hash在c#中解密密码?

[英]How to Decrypt Password in c# using Salt and Hash.?

How to Decrypt Password in c# using Salt and Hash.? 如何使用Salt和Hash在c#中解密密码? Salt and Hash already stored in SQL Server. Salt和Hash已存储在SQL Server中。

哈希和盐

Here is attached screenshot of Database with hash salt and Hash. 这是带有哈希盐和哈希的数据库的屏幕快照。

Depending on how you encrypt it, you probably can't decrypt it as Hash algorithms are generally one-way. 根据哈希的加密方式,您可能无法解密,因为哈希算法通常是单向的。

The only viable solution you have would be to bruteforce the hash and salt which by looking at it would take forever. 您拥有的唯一可行的解​​决方案是强加于哈希和盐,这些哈希和盐将永远存在。

If you know how the data is encrypted in relation to the salt then this is relatively simple, and can be done either manually or automatically. 如果您知道与盐有关的数据加密方式,则这相对简单,可以手动或自动完成。

More about it here: https://msdn.microsoft.com/en-us/library/ee783861(v=cs.20).aspx 此处的更多信息: https : //msdn.microsoft.com/zh-cn/library/ee783861(v=cs.20).aspx

I'm going to assume that this table is all there is, that there is no 'password' column or table. 我将假定该表已存在,没有“密码”列或表。 In which case: 在这种情况下:

There are no passwords here to decrypt, because this table does not contain passwords. 这里没有密码可解密,因为此表不包含密码。

Here's what's going on: the user creates a password. 这是怎么回事:用户创建密码。 It's hashed (using the salt) and stored as 123ABC . 它被散列(使用盐)并存储为123ABC When they log on, they enter the password, which is then hashed (using the salt) and compared to the saved hash. 当他们登录时,他们输入密码,然后将其哈希(使用盐)并保存的哈希进行比较 If it comes out as 123ABC , fine. 如果它显示为123ABC123ABC好。

The good part is, you never save the passwords, so they can't be stolen. 好消息是,您永远不会保存密码,因此密码不会被盗。 Ever. 永远。

The bad part is that other strings will also hash to 123ABC , so someone with a table of all possible hashes (called a 'rainbow table') can get in using some other, known match. 不好的部分是其他字符串将哈希到123ABC ,因此拥有所有可能哈希表的人(称为“彩虹表”)可以使用其他已知的匹配项。 That's where the salt comes it, it makes it much harder to figure out possible matches. 那就是盐的来源,这使得找出可能的比赛变得更加困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM