MD5 em VB.Net
Imports System.Security.Cryptography
Public Function Encriptar_MD5(ByVal StrEntrada As String) As String
Dim ObjMD5 As New Security.Cryptography.MD5CryptoServiceProvider
Dim BytHash() As Byte = System.Text.Encoding.ASCII.GetBytes(StrEntrada)
Dim StrReturn As String = Nothing
BytHash = ObjMD5.ComputeHash(BytHash)
For Each ByteToEach As Byte In BytHash
StrReturn += ByteToEach.ToString("x2")
Next
Return StrReturn.ToUpper
End Function
MD5 em C#
using System.Security.Cryptography;
public string Encriptar_MD5(string StrEntrada)
{
Security.Cryptography.MD5CryptoServiceProvider ObjMD5 = new Security.Cryptography.MD5CryptoServiceProvider();
byte[] BytHash = System.Text.Encoding.ASCII.GetBytes(StrEntrada);
string StrReturn = null;
BytHash = ObjMD5.ComputeHash(BytHash);
foreach (byte ByteToEach in BytHash) {
StrReturn += ByteToEach.ToString("x2");
}
return StrReturn.ToUpper;
}
Por hoje é só pe pe pessoal...
Nenhum comentário:
Postar um comentário