When I normally return the Ajax/JSON from PHP, the Javascript get it and stores it inside a variable, like: var myJSON = ajaxReturnedJSON; Then Javascript read it.
I'm seriously curious to know if, php encrypts the json:
echo json_encode($encrypted_data); //using some key like: "abc123"
Javascript decrypt it back by using same key?encrypt/decrypt method between php and js?Note: I understand key will be visible at JS side but i can also use JS Obfucators to hex the whole characters, whole JS file. So more or less it will protect, rather then plain/nothing.
Welcome to any ideas and discussions.
Sure. Encryption and decryption algorithms are just mathematical operations which can be performed in virtually any programming language. Javascript being a programming language you can implement any decryption algorithm in it you need.
This is typically pretty pointless though if this Javascript is running in the browser. Encryption is used to hide information from somebody. In a server-client scenario, there are three parties: web server, browser/user, third parties. Now:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With