Common encryption algorithm

xiaoxiao2021-03-06  114

Public static string hashcryptstring (Stringst, String Method) {

IF (Method == "MD5") {

Strtext = System.Web.Security.FormSauthentication.hashPasswordforstoringInfigfile (Strtext, "MD5");

// md5 md5 = new md5cryptoserviceProvider ();

// strText = system.text.encoding.utf8.getstring (md5.computehash (system.text.encoding.utf8.getbytes (strtext)));

}

Else IF (Method == "SHA1") {

Strtext = System.Web.Security.FormSauthentication.HashPasswordforstoringInconfigfile (Strtext, "SHA1");

// sha1 sha1 = new sha1cryptoserviceProvider ();

// strText = system.text.encoding.utf8.getstring (sha1.computehash (system.text.encoding.utf8.getbytes (strText))));

}

Return strText;

}

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

New Post(0)