Common string SHA 1Encrypt (string pwd)
{
sha 1 sha 1 = sha 1。 create();
Byte [] Byte =
sha 1。 ComputeHash (encoding. default . GetBytes(pwd));
sha 1。 clear();
String result = BitConverter. ToString (bytes);
Return the result;
}
The following are some common encryption methods of C#:
// MD5 encryption
Common string MD5Encrypt (string pwd)
{
MD5 md5 = MD5。 create();
Byte [] Byte =
md5。 ComputeHash (encoding. default . GetBytes(pwd));
md5。 clear();
String result = BitConverter. ToString (bytes);
Return the result;
}
// SHA256 encryption
Common string SHA256Encrypt (string pwd)
{
SHA256 sha = SHA256create();
Byte [] Byte =
Sand. ComputeHash (encoding. default . GetBytes(pwd));
Sand. clear();
String result = BitConverter. ToString (bytes);
Return the result;
}
// SHA384 encryption
Common string SHA384Encrypt (string pwd)
{
SHA384 sha = SHA384create();
Byte [] Byte =
Sand. ComputeHash (encoding. default . GetBytes(pwd));
Sand. clear();
String result = BitConverter. ToString (bytes);
Return the result;
}
// SHA5 12 encryption
Common string SHA5 12Encrypt (string pwd)
{
SHA5 12 sha = SHA5 12create();
Byte [] Byte =
Sand. ComputeHash (encoding. default . GetBytes(pwd));
Sand. clear();
String result = BitConverter. ToString (bytes);
Return the result;
}