zoukankan      html  css  js  c++  java
  • 数据加密和解密


                
    if(!File.Exists("c:\\user.ini"))
                
    {
                    StreamWriter sw 
    = new StreamWriter("c:\\user.ini");
                    
    string strName = tbName.Text;
                    
    string strPass = tbPass.Text;
                    
    string strEncryPass = System.Web.Security.FormsAuthentication.
                        HashPasswordForStoringInConfigFile(strPass,
    "md5");
                    sw.WriteLine(strName);
                    sw.WriteLine(strEncryPass);
                    sw.Close();
                    
    // 数据加密函数System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(strPass,"md5")
                }

                
    else
                
    {
                    
    //从user.ini中读出保存的用户名称和密码,进行比较
                    StreamReader sr = new StreamReader("c:\\user.ini");
                    
    string strSaveName = sr.ReadLine();
                    
    string strSavePass = sr.ReadLine();
                    sr.Close();
                    
    string strInputPass = System.Web.Security.FormsAuthentication
                        .HashPasswordForStoringInConfigFile(tbPass.Text,
    "md5");
                    
    if(strSaveName!=tbName.Text||strSavePass!=strInputPass)
                    
    {
                        Response.Write(
    "用户名称或密码错误!");
                        mainPanel.Visible 
    = false;
                    }

                    
    else
                        Response.Write(
    "<script language = javascript>alert('成功登录!')</script>");
                }
    数据加密
        方法一:
      
  • 相关阅读:
    破周三,前不着村后不着店的,只好学pandas了,你该这么学,No.9
    周一不睡觉,也要把pandas groupy 肝完,你该这么学,No.8
    大周末的不休息,继续学习pandas吧,pandas你该这么学,No.7
    链接
    音乐
    术语
    新闻
    我的文章分类
    我的代码规则
    Jenkins 访问特别慢,且不消耗服务器资源
  • 原文地址:https://www.cnblogs.com/ghd258/p/254963.html
Copyright © 2011-2022 走看看