将字符串转换为GUID,将GUID转换为旧字符串。反之亦然 [英] Convert string to GUID and GUID to old string. Vise versa
问题描述
我使用以下代码从字符串创建了guid:
私人Guid GetGuid(字符串输入)
{
MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
byte [] inputBytes = Encoding.Default.GetBytes(input);
byte [] hashBytes = provider.ComputeHash(inputBytes);
Guid hashGuid = new Guid(hashBytes);
返回hashGuid;
}
假设我给出了输入参数Arvind和得到了像:77f92c53-38af-42f6-8289-fddbd32f228d
现在我想把这个guid77f92c53-38af-42f6-8289-fddbd32f228d转换回我的原始字符串是Arvind。有什么办法吗?
Thaks,
Arvind
我尝试过的:
............................. ..............................
I have created guid from a string using below code:
private Guid GetGuid(string input)
{
MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
byte[] inputBytes = Encoding.Default.GetBytes(input);
byte[] hashBytes = provider.ComputeHash(inputBytes);
Guid hashGuid = new Guid(hashBytes);
return hashGuid;
}
suppose i given input parameter "Arvind" and got guid like: 77f92c53-38af-42f6-8289-fddbd32f228d
now i want to convert this guid "77f92c53-38af-42f6-8289-fddbd32f228d" back to my original string which is "Arvind" . is there any way?
Thaks,
Arvind
What I have tried:
...........................................................
推荐答案
没有反转哈希操作的方法(从哈希中检索原始字符串)。这是出于意图而且通常是一项要求。
然而,有可能使用蛮力攻击 - 维基百科 [ ^ ]或字典攻击 - 维基百科 [ ^ ]。
欲了解更多信息,只需搜索一些东西比如md5 reverse hash。
There is no way to reverse a hash operation (retrieve the original string from the hash). That is by intention and usually a requirement.
Howewer, it might be possible to retrieve it using a Brute-force attack - Wikipedia[^] or a Dictionary attack - Wikipedia[^].
For more information just search for something like "md5 reverse hash".
这篇关于将字符串转换为GUID,将GUID转换为旧字符串。反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!