javascript - How to encrypt the value of the url parameter when passing the value to another page using js get?

WBOY
Release: 2016-08-04 09:22:09
Original
1326 people have browsed it

I recently encountered the need to use js to transfer three values ​​​​to another page without allowing the parameters to be displayed directly in the URL. It needs to be encrypted. How to deal with it?
javascript - How to encrypt the value of the url parameter when passing the value to another page using js get?

Reply content:

I recently encountered the need to use js to transfer three values ​​​​to another page without allowing the parameters to be displayed directly in the URL. It needs to be encrypted. How to deal with it?
javascript - How to encrypt the value of the url parameter when passing the value to another page using js get?

Commonly used PHP functions urlencode and urldecode are here. There are also base64_encode and base64_decode, which are mostly used for image encryption. Here is a link for your reference: Several commonly used encryption functions in PHP

Use post?

If you don’t want to display it behind the url, then use the post method of the form;
If you just want to ‘encrypt’ it, you can encodeURIComponent;

If you just encrypt it, you can use Base64.encode64 to decrypt Base64.decode64

If you just want to prevent passers-by from seeing it,
@hit水ヽ’s base64_encode is a better way.
base64 is just encoding, because no one can decode it verbally...
You can consider packaging the three values ​​​​into json, and then base64 encoding the json string.

If it is a jump from one web service A to another web service B, A and B want to communicate through this encryption.
You can consider referring to the encryption scheme of WeChat Enterprise Account.
In fact, both A and B know a set of secret keys, and then A uses the secret key to encrypt the message, converts it to base64, puts it in the query, and passes it to B.

p.s. Can I complain about style=original...

The poster probably doesn’t want others to know the parameters, right? Then encodeURIComponent and the like will definitely not work, it is just encoding.

base64 is not strictly speaking encryption.

RSA?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template