The easiest way to use data encryption in school is to vary or see someone want to encrypt the algorithm, the previous information turned over, sorted out a series of cryptographic functions, of course, simple encryption is easy to crack, but better than nothing (remember to put the secret to the key), It's better than having someone open the database and see the code. :-)
' XOR ' or ' encryption '
Function EnCrypt (Strcryptthis)
Dim Strchar, Ikeychar, Istringchar, I
For i = 1 to Len (strcryptthis)
Ikeychar = ASC (Mid (strfullkey,i,1))
Istringchar = ASC (Mid (strcryptthis,i,1))
Icryptchar = Ikeychar Xor Istringchar
strencrypted = strencrypted & Chr (Icryptchar)
Next
EnCrypt = strencrypted
End Function
' Xor or decryption
Function DeCrypt (strencrypted)
Dim Strchar, Ikeychar, Istringchar, I
For i = 1 to Len (strencrypted)
Ikeychar = (ASC (mid strfullkey,i,1))
Istringchar = ASC (Mid (strencrypted,i,1))
Idecryptchar = Ikeychar Xor Istringchar
strdecrypted = strdecrypted & Chr (Idecryptchar)
Next
DeCrypt = strdecrypted
End Function
' Generates a random key of the specified length
Function KeyGen (strlength)
Dim I,ub
Dim Temp
Dim Poss
Poss = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Temp = ""
UB = Len (Poss)
For i = 1 to Strlength
Randomize
Temp = temp & Mid (Poss,int (UB-0 + 1) * Rnd + 1), 1)
Next
KeyGen = Temp
End Function
%>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.