Jump to content

[SOLVED] function to use to encrypt & decrypt strings


mega77

Recommended Posts

I'm trying to find some function to encrypt & decrypt strings. The security level of the function is not a problem, even a very low security function is ok for my purpose. The string length that I need to encrypt would be between 45 to 60 chars.

 

- Mcrypt encrypts/decrypts strings but the results are 100 or so char long, which is far too long for my needs.

 

- base64encode is also too long.

 

- The ideal would be a crc32-like function (the resulting length is small, perfect) but unfortunately it cannot be decrypted.

 

Can anybody direct me to a small function that can encrypt and decrypt ?

If you want something "very low security" as you've defined, you can go for something simple as:

 

<?php
function code ($str)
{
return str_rot13(strrev($str));
}
?>

 

This is very very simple... You can use this function to both decode and encode the string.

 

Orio.

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.