Paip. cross-platform custom Encryption Method

Source: Internet
Author: User

Paip. cross-platform custom Encryption Method

Currently, parameters are transmitted between ASP and PHP system modules. For convenience, you do not need to use MD5 signatures.

DES encryption .. However, DES in ASP and PHP cannot be encrypted with each other... What CBC mode and IV vector are there?

. A lot of data. I still can't adjust it for a long time. Forget it. Write your own encryption method ..

The main method of password encryption is to replace and shift .. In addition, I want to use keys and algorithms.

Simple .. The DES algorithm is a big problem, MD, and difficult to use. PASS... Although the results are good, it is a bit complicated and difficult to rewrite.

..

Here, I have conceived the idea of encryption and encryption:

1. First reverse the string
2. cyclically add strings and KEY groups
3. The added result is converted into hexadecimal characters .. It is mainly used to save some space ..
4. The returned result is OK...
5. The decryption process can be reversed ..

Dim key_L71723
Key_L71723 = "iluvnjyn"
Dim msg
Msg = "admin"

Dim newstr
Newstr = atiEncode (msg, key_L71723)
Response. Write (newstr) 'shows that the encryption result is D7D5E2DACF
Response. Write (atiDecode (newstr, key_L71723 ))

---------------------------------------------
Function atiEncode (msg, key)

Msg = back_str (msg) 'reverse the string
Dim key_L71723
Key_L71723 = key
Key_L71723 = key_L71723 + key_L71723
Key_L71723 = key_L71723 + key_L71723
Key_L71723 = key_L71723 + key_L71723
Dim msgarr
Msgarr = str2array (msg)
Dim keyarr
Keyarr = str2array (key_L71723)
Dim newstr
Newstr = ""
'And the KEY group are added cyclically
For I = 0 to ubound (msgarr)
Dim char
Char = msgarr (I)
Dim newchar 'int format
Newchar = asc (char) + asc (keyarr (I ))
Newchar = hex (newchar)

Newstr = newstr + cstr (newchar)
Next

AtiEncode = newstr
End function

 

Function atiDecode (msg, key)
 
Dim key_L71723
Key_L71723 = key
Key_L71723 = key_L71723 + key_L71723
Key_L71723 = key_L71723 + key_L71723
Key_L71723 = key_L71723 + key_L71723
Dim msgarr
Msgarr = str2arrayx (msg, 2)
Dim keyarr
Keyarr = str2array (key_L71723)
Dim newstr
Newstr = ""

For I = 0 to ubound (msgarr)
Dim charInt
 
CharInt = chn10 (msgarr (I) 'encode char

Dim newchar www.2cto.com
Newchar = chr (charInt-ascw (keyarr (I )))
Newstr = newstr + newchar
Next

Newstr = back_str (newstr)
AtiDecode = newstr
End function


Author: attilax

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.