How do I encrypt the value of a URL parameter when Javascript-js get is passed to another page?

Source: Internet
Author: User

Recently encountered the need to use JS to pass three values to another page, do not let the parameters directly displayed in the URL need to encrypt, how to handle?

Reply content:

Recently encountered the need to use JS to pass three values to another page, do not let the parameters directly displayed in the URL need to encrypt, how to handle?

Common PHP functions urlencode and urldecode the. There is also a base64_encode and base64_decode , this much used for image encryption. Here is a link, you refer to the following: PHP a few common cryptographic functions

With post?

If you do not want to appear behind the URL, then use the form form of the Post method;
If just want to ' encrypt ' a bit, can encodeuricomponent;

If you just encrypt it, you can decrypt it with base64.encode64 base64.decode64

If you just don't let the passers-by see it,
@ Hit the water's finger licking base64_encode is a better way.
Base64 is just coding, because no one can mental arithmetic decode ...
Consider packing the three values into JSON and then encoding the JSON string with base64.

If it is a jump from a Web service A to another Web service B, a and B want to communicate through this encrypted communication.
Consider the encryption scheme for the enterprise number.
Actually A and B both know a set of keys, and a uses the secret key to encrypt the message, to base64 the process of passing it to B in query.

P.S. Can I spit a notch style=原味 ?

Landlord should not let the parameters let others know it? Then the encodeuricomponent and the like must not be, just coding.

Base64 is not strictly a cryptographic bar.

Rsa?

  • 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.