编码使用JavaScript和PHP解码

i want to use js for encode a url and then pass it encode hash by url and access it on a page with $_GET[]; and echo decode the hash use PHP.

I want to know both js and php code !

Note: "just want to use js for make a url google.com like (NU18D65148sdaDASSsd11s5a151f15FDFSD151) and pass it by url like show.php?key=NU18D65148sdaDASSsd11s5a151f15FDFSD151 on show.php decrypt on google.com" That is !!

Code Example Pleas !

Thanks!

Hummm we can use js base64 for encode https://github.com/dankogai/js-base64 and pass it by url variable then access it for decode on php use base64_decode();

<?php
    $str = $_GET['key'];
    echo base64_decode($str);
?>

It's very broad question.

What kind of encryption you want to use?

It should be both symetric and asymetric because when you use symetric key it can be visible from JavaScript code. So it would be better to generate for example random AES key in JavaScript then encrypt it with public code given by php script and pass it encrypted key to php. Then PHP decrypts the AES key with private key and decrypts content with AES

Some links: