How to make MD5 encryption in ASP.NET!

xiaoxiao2021-03-06  14

// Suitable for C # language // Need to import the following namespace before use: use system.web.security; // The first parameter is a string that needs to be encrypted, the second parameter is encrypted format (only SHA1 and MD5 two species, may optionally one) public string EncryptPassword (string PasswordString, string passwordFormat) {string EncryptPassword = null; if ( "SHA1" .Equals (passwordFormat)) {EncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile (PasswordString, "SHA1");} else if ( "MD5" .Equals (passwordFormat)) {EncryptPassword = FormsAuthentication.HashPasswordForStoringInConfigFile (PasswordString, "MD5");} else {EncryptPassword = PasswordString;} return EncryptPassword;}

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

New Post(0)