S
shapper
Hello,
I created a String extension to hash using MD5 and SHA1:
public static String Hash(this String value, EncryptionType type)
{
// Hash value
Byte[] hash = null;
UTF8Encoding encoder = new UTF8Encoding();
switch (type) {
case EncryptionType.MD5:
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider
();
hash = md5.ComputeHash(encoder.GetBytes(value));
break;
case EncryptionType.SHA1:
SHA1CryptoServiceProvider sha1 = new
SHA1CryptoServiceProvider();
hash = sha1.ComputeHash(encoder.GetBytes(value));
break;
}
return BitConverter.ToString(hash).Replace("-", String.Empty);
} // Hash
What is the relation between the original string length and the hashed
string lenth?
Thanks,
Miguel
I created a String extension to hash using MD5 and SHA1:
public static String Hash(this String value, EncryptionType type)
{
// Hash value
Byte[] hash = null;
UTF8Encoding encoder = new UTF8Encoding();
switch (type) {
case EncryptionType.MD5:
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider
();
hash = md5.ComputeHash(encoder.GetBytes(value));
break;
case EncryptionType.SHA1:
SHA1CryptoServiceProvider sha1 = new
SHA1CryptoServiceProvider();
hash = sha1.ComputeHash(encoder.GetBytes(value));
break;
}
return BitConverter.ToString(hash).Replace("-", String.Empty);
} // Hash
What is the relation between the original string length and the hashed
string lenth?
Thanks,
Miguel