zoukankan      html  css  js  c++  java
  • 在asp.net中使用MD5加密

    在asp.net中使用MD5加密
    2009年5月3日22:31:08

    MD5加密算法是不可逆的,也就是说不能把MD5加密后的字符串解密出来
    但是我们在程序中仍然是可以使用MD5加密算法的,比如登陆

    在添加帐户的时候把密码进行MD5加密:

    string pwd = "lijun520120";
      
    string newpwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, "MD5");

    newpwd及是加密后的文件保存在数据库即可~~~

    当我们验证的时候再加密一次,判断加密后的文件是否相等,就可以判断出用户输入的密码是否正确了!
    如用户输入密码为"520120"

    string password="520120";

    string newpassword= FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");

    这里判断newpassword 是否等于 数据库取出的newpwd即可

  • 相关阅读:
    makefile 3
    makefile 3
    wzplayer for delphi demo截图
    makefile 2
    makefile
    wzplayer for delphi demo截图
    clang complete
    makefile
    clang complete
    linux最常用命令集合
  • 原文地址:https://www.cnblogs.com/gaojun/p/1448380.html
Copyright © 2011-2022 走看看