Tomado bajo total e irresponsable desfachatez de aqui.
using System;
using System.Security.Cryptography;
using System.Text;
namespace MD5_CS
{
public class cMD5
{
public cMD5(){}
public string ObtenerMd5 (string pass)
{
MD5 md5 = MD5CryptoServiceProvider.Create ();
byte[] dataMd5 = md5.ComputeHash (Encoding.Default.GetBytes (pass));
StringBuilder sb = new StringBuilder();
for (int i = 0; i <>
Y Visual Basic
Imports System
Imports System.Security.Cryptography
Imports System.Text
Namespace MD5_CS
Public Class cMD5
Public Sub New()
End Sub
Public Function ObtenerMd5(ByVal pass As String) As String
Dim md5 As MD5 = MD5CryptoServiceProvider.Create()
Dim dataMd5() As Byte = md5.ComputeHash(Encoding.Default.GetBytes(pass))
Dim sb As StringBuilder = New StringBuilder()
Dim i As Integer
For i = 0 To dataMd5.Length- 1 Step i + 1
sb.AppendFormat("{0:x2}", dataMd5(i))
Next
Return sb.ToString()
End Function
End Class
End Namespace
No hay comentarios:
Publicar un comentario