Two hash encryption algorithms: MD5, SHA1

xiaoxiao2021-03-06  89

// It turns out in a webservice so there is a string of the back [WebMethod (Description = "provides two hash encryption algorithms: MD5, SHA1. Sensitive.")]]

Public String Encryptpassword (String PasswordString, String PasswordFormat)

{

String result = "";

Switch (PasswordFormat)

{

Case "SHA1":

Result = formsauthentication.hashpasswordforstoringInconfigfile (PasswordString, "SHA1");

Break;

Case "MD5":

Result = Formsauthentication.hashPasswordforstoringInconfigfile (PasswordString, "MD5");

Break;

DEFAULT:

Result = "";

Break;

}

Return Result;

}

转载请注明原文地址:https://www.9cbs.com/read-105457.html

New Post(0)