开发者

simple symmetric encryption algorithm in php

I am looking for simple symmtric algorithm (low on processing power) in php.

An encrypted value will be stored as a session_id on client end. And will have logged in stat开发者_如何学Cus saved in it.

Also I need to also decrypt it on server side. Please suggest....


The only constraint you've mentioned is low processing impact - but you've provided no details of the strength of the algorithm required.

Also, if the encryption is implemented in PHP, then it will be several orders of magnitude less efficient than native code as provided by the mcrypt extension (and others).

An encrypted value will be stored as a session_id

Why????

The session id is randomly generated and therefore not predictable / guessable. And sessions provide a mechanism for storing data on the server. If the issue is to maintain secure data outside of the session due to shared hosting constraints, then this is not the right way to solve the problem.

There are native PHP implementations of various algorithms, TEA being an obvious choice, and str_rot13() is available even if mcrypt/openssl extensions are unavailable. But I can see no logical application of these methods to any problem.


I suggest you use the mcrypt-extension. there you go for some simple examples.

It offers you many symmetric encryptions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜