且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何加密数据在javascript和解密php?

更新时间:2023-02-07 09:09:56

我不知道通过在javascript中进行加密可以获得什么。您的整个例行程序和加密密钥可供公众有效使用。如果您想防止嗅探,您应该使用SSL。


Is there any javascript function that can encrypt data: For example i want to use encrypted data in my URL passed by ajax GET request,

http://sample.com/mypage/TDjsavbuydksabjcbhgy

where TDjsavbuydksabjcbhgy an encrypted data equivalent to 12345. Now i want to retrieve that data in PHP by decrypting it, so that i can use the 12345.

Is it possible? or any suggestion on how to do that.

Thanks in advance.

I'm not sure what you would gain by doing encryption in javascript. Your entire routine and encryption key are effectively available to the public. If you are trying to protect against sniffing, you should use SSL.