MD5CryptoServiceProvider

MD5CryptoServiceProvider

本文介绍了将字符串转换为GUID,将GUID转换为旧字符串。反之亦然的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码从字符串创建了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:

...........................................................

推荐答案


这篇关于将字符串转换为GUID,将GUID转换为旧字符串。反之亦然的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 02:54