Unhashing哈希C# [英] Unhashing a hash C#

查看:113
本文介绍了Unhashing哈希C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能扭转我用这个方便的哈希code?

Can someone reverse this handy hash code I'm using?

using System.Security.Cryptography;

public static string EncodePasswordToBase64(string password)
{  byte[] bytes   = Encoding.Unicode.GetBytes(password);
   byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(bytes);
   return Convert.ToBase64String(inArray);
}

一切我最终会做可怕的失败:(

Everything I end up doing fails horribly :(.

推荐答案

没有,你不能扭转哈希值。典型的过程是将其他输入比较有散列,以检查它们是否相同。

No, you can't reverse a hash. The typical process is to compare other input to the hash you have, to check if they are the same.

赞(伪):

initial  = Hash(password);
possible = Hash("test");

if( initial == possible ){
    // we infer that password = "test"
}

但要注意,SHA1,SHA0和MD5不应该再被使用; (由于不同程度的每个打破)。您应该使用SHA-2

But note that SHA1, SHA0, and MD5 should no longer be used; (due to various degrees of breaking in each). You should use SHA-2

这篇关于Unhashing哈希C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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