.NET MD5 加密代码 (C#)
2007-08-29 21:43
507 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
using System.Security.Cryptography;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
namespace ArLi.CommonPrj
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public class getMD5
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
public getMD5()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//// 返回 MD5 值
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
/// 要转换的 MD5 值的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
public string getOf(string myString) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MD5 md5 = new MD5CryptoServiceProvider();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] fromData = System.Text.Encoding.Unicode.GetBytes(myString);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] targetData = md5.ComputeHash(fromData);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string byte2String = null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for (int i=0; i"x");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return byte2String;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
/**//// 返回 MD5 值
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
/// 要转换的 MD5 值的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
/// 分隔符
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
public string getOf(string myString,string splitChar) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MD5 md5 = new MD5CryptoServiceProvider();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] fromData = System.Text.Encoding.Unicode.GetBytes(myString);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] targetData = md5.ComputeHash(fromData);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string byte2String = null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for (int i=0; i"x") + splitChar;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
if (splitChar != null && splitChar != "")...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return byte2String.Remove(byte2String.Length -1,1);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return byte2String;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
/**//// 返回 MD5 值
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
/// 要转换的 MD5 值的字符串
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
/// 分隔符
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
public string getOf(string myString,char splitChar) ...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
MD5 md5 = new MD5CryptoServiceProvider();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] fromData = System.Text.Encoding.Unicode.GetBytes(myString);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
byte[] targetData = md5.ComputeHash(fromData);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
string byte2String = null;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for (int i=0; i"x") + splitChar;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
return byte2String.Remove(byte2String.Length -1,1);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
}
相关文章推荐
- .NET MD5 加密代码 (C#)
- .NET MD5 加密代码 (C#)
- [导入].NET 加密 通用代码(c#)
- .net md5加密后的代码
- 测试Rockey 4 Smart加密锁的.Net C#语言代码
- 测试Rockey 4 Smart加密锁的.Net C#语言代码
- .NET(C#)代码加密
- .NET 中的MD5及hash加密以及密文输出(C#)
- .NET 加密 通用代码(c#)
- C#中 MD5和SHA1加密代码
- .net加密技术的应用(加密类代码参考)
- MD5的32位16位加密解密代码
- C#下Base64、MD5、AES加密
- 跟小静读CLR via C#(01)-.NET平台下代码是怎么跑起来的
- 一起谈.NET技术,C#特性Attribute的实际应用之:代码统计分析
- c# 中對輸入的值用md5或Hash加密
- .NET下对二进制文件进行加密解密(C#)
- .net中C#代码与javaScript函数的相互调用问题
- 转:C#使用Dotfuscator混淆代码的加密方法
- C#:使用MD5对密码进行加密!