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
Newchar = CHR (charint-ASCW (keyarr (I )))
Newstr = newstr + newchar
Next

Newstr = back_str (newstr)
Atidecode = newstr
End Function

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.