Encryption method in ASP.NET

xiaoxiao2021-03-06  100

This article is copyrighted by chenyangasp, reproduced, copy, paste, and please indicate the source, but you must not modify! Whenever we use the database development website, we must protect user information, which is necessary. Hackers can steal the password, personal privacy is seriously damaged. The best way is not to store the original password, but put it in the database after encryption. When we want to verify the user, we only need to encrypt the password entered by the user to compare the records in the database. In ASP we need additional object encryption. However, SDK in ASP.NET can solve the problem via the HashPasswordforStoringInfigfile method of the cookieAuthentication class in System.Web.Security Namespace. The purpose of this is to encrypt the password of the profile, even the cookies.hashpasswordforStoringInconfigfile method is very easy, and it supports "SHA1" and "MD5" hash algorithms. In order to clear the "HashPasswordforStoringInconfigfile" method, let's make a small ASP.NET page, transder the input string into a password in the SHA1 and MD5 format. now go <% @ Import Namespace = "System.Web.Security"%>