Security | code | Encryption How did you store the password in the database? Is it in plain text? Do you know how dangerous this is for security? When the person attacking your site can open database browsing, there is no doubt about the password in the database in plain text, do you want to do this properly, based on security considerations? Is there any way to get people to see the data in the database and not to know the password stored in it?
Do you know how to solve the above problem? This article to tell you how to encrypt your password processing, processing after the password string, even if the public came out and no one guessed the original password! First, let's look at a set of strings:
27b827277c70e88dd87e3057bfbe8f
This is the result of encrypting the password, do you know what the string is before the encryption? is actually "test". It's unbelievable! After processing the string, and the original string is completely different, I do not say you guessed it? If the person who decides the password does not say, this password is always a secret!
After all, this is based on the original string to start coding, you may be afraid of someone using reverse engineering to convert the string back to the original password, which you do not have to worry about, this code is "one-way", can not use reverse engineering recovery! As long as the password encrypted and then stored in the database, your password will be a more secure! When compared to the password, the user input password is encrypted and then compared with the database. Talk a lot and start telling you how to write this program now.
We use the encryption method "CFS coded encryption function library", please in the "ASP Technology Plaza website → file download → related components → function library" Download its function contains files. This is the "ASP Technology Plaza" created by the encryption method, different from the market other encryption coding methods! Download the file back to the zip file, please unzip to the same directory as your ASP.
<!--#include file= "Codefun.fun"-->
This is used to add a function include file to your ASP, please add it at the beginning of ASP, then you can use its encoding function.
Use of the Encoding function Cfsencode ():
Var = Cfsencode (string source)
Example:
<%dim Sourcedim var1source = "Test" VAR1 = Cfsencode (Source) Response.Write var1%>
Execution results:
27b827277c70e88dd87e3057bfbe8f
<%
'********************************************************************************
'* *
' * CFS Encode Function *
'* *
' * Produced by Asp-zone *
'* *
' * Main website is located at *
' * http://asp.diy.com.tw/*
'* *
' * e-mail: *
' * thiefghost@games.com.tw *
'* *
' * Use this function: *
' * <!--#include file= "Codefun.fun"--> *
'* *
' * 2001/8/3 *
'* *
'********************************************************************************
' Encode Function
Function Cfsencode (CODESTR)
Dim Codelen
Dim Codespace
Dim Newcode
Codelen = 30
Codespace = Codelen-len (CODESTR)
If not Codespace < 1 Then
For CECR = 1 to Codespace
Codestr = codestr & Chr (21)
Next
End If
Newcode = 1
Dim Been
For CECB = 1 to Codelen
Been = Codelen + ASC (Mid (codestr,cecb,1)) * CECB
Newcode = Newcode * Been
Next
Codestr = Newcode
Newcode = Empty
For CEC = 1 to Len (CODESTR)
Newcode = Newcode & Cfscode (Mid (codestr,cec,3))
Next
For CEC = to Len (newcode)-2
Cfsencode = Cfsencode & Mid (newcode,cec,1)
Next
End Function
Function Cfscode (Word)
for cc = 1 to Len (Word)
Cfscode = Cfscode & Asc (Mid (word,cc,1))
Next
Cfscode = Hex (Cfscode)
End Function
%>