数据加密和解密

简介:

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

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

InBlock.gif                
else
InBlock.gif                    Response.Write(
"<script language = javascript>alert('成功登录!')</script>");
ExpandedBlockEnd.gif            }




本文转自高海东博客园博客,原文链接:http://www.cnblogs.com/ghd258/archive/2005/10/14/254963.html,如需转载请自行联系原作者
相关文章
|
7月前
|
存储 算法 安全
第4章 数据库安全性——4.5 数据加密
第4章 数据库安全性——4.5 数据加密
|
1月前
|
存储 算法 安全
密码学系列之九:密钥管理
密码学系列之九:密钥管理
259 45
|
3月前
|
数据安全/隐私保护
突然遇到一个加密需求和解密需求
突然遇到一个加密需求和解密需求
22 0
|
10月前
|
算法 安全 数据安全/隐私保护
数据加密
数据加密
111 0
|
存储 安全 算法
现代密码学-密钥管理技术
现代密码学-密钥管理技术
345 0
现代密码学-密钥管理技术
|
算法 JavaScript 前端开发
数据加密插件
数据加密插件
|
存储 网络安全 数据安全/隐私保护
赶紧!快加密吧!
hello,大家好,我是Jackpop。今天跟大家聊一下隐私保护的话题。 使用电脑久了,日积月累,都会沉淀下来一些隐私信息,内容包含但不限于文档、音频、视频等形式。
|
安全 算法 网络安全
【计算机网络】网络安全 : 数据加密模型 ( 加密模型 | 密钥 | 密码学 | 密码安全 )
【计算机网络】网络安全 : 数据加密模型 ( 加密模型 | 密钥 | 密码学 | 密码安全 )
517 0
【计算机网络】网络安全 : 数据加密模型 ( 加密模型 | 密钥 | 密码学 | 密码安全 )
|
安全 数据安全/隐私保护
安全加密之-PAM
时间:2018.1.16作者:李强参考:man,info,magedu讲义,万能的internet实验环境:VMware® Workstation 12 Pro ,Centos 6.9,Centos 7.4,SecureCRT Version 8.1.4声明:以下英文纯属个人翻译,英文B级,欢迎纠正,以下内容纯属个人理解,并没有对错,只是参考,盗版不纠,才能有限,希望不误人子弟为好。
927 0