Introduction
This Page deals provides an Example code to show how to implement the .NET MD5 and SHA-1 cryptography Class.
In order to use the MD5 or SHA-1 Class that .NET provides, u must realize that it accepts and returns byte arrays only.
public byte[] ComputeHash ( byte[] buffer , System.Int32 offset , System.Int32 count )
this means that u have to convert the string to a byte array, send it to the function and prepare to convert the result byte array back to string.
this was done using this code i found here on code project:
public string encryptString(byte[] RawStringBytes)
{
representative
string hashString ="";
for(int i=0;i<RawStringBytes.Length;i++)
{
hashString += Convert.ToString(RawStringBytes[i], 16).PadLeft(2,'0');
}
return hashString.PadLeft(32,'0');
}
just download and examine the c# coding for more details on how it works.
Ayson Baxter Bsc.
born 1984, this young Jamaican programmer is enthused by Network programming and security.