• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Admin

Well-Known Member
Staff member
Administrator
C#:
Code:
public static byte[] encryptData(string data)
    {
        System.Security.Cryptography.MD5CryptoServiceProvider md5Hasher = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] hashedBytes;
        System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
        hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(data));
        return hashedBytes;
    }
public static string md5(string data)
        {
            return BitConverter.ToString(encryptData(data)).Replace("-","").ToLower();
        }
VD:
Code:
md5("123"); ///Kết quả: 202cb962ac59075b964b07152d234b70
VB.NET:
Code:
Public Shared Function encryptData(data As String) As Byte()
    Dim md5Hasher As New System.Security.Cryptography.MD5CryptoServiceProvider()
    Dim hashedBytes As Byte()
    Dim encoder As New System.Text.UTF8Encoding()
    hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(data))
    Return hashedBytes
End Function

Public Shared Function md5(data As String) As String
    Return  BitConverter.ToString(encryptData(data)).Replace("-","").ToLower();
End Function
 

Facebook Comments

Similar threads

New posts New threads New resources

Back
Top