Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » RADICORE Suggestions » std.encryption.class.inc
std.encryption.class.inc [message #813] Tue, 08 May 2007 18:59 Go to next message
cpscdave is currently offline  cpscdave
Messages: 20
Registered: June 2006
Junior Member
I'm not sure if other people would need this, but occasionally I've found it useful to store data that needs to obscured from normal users.

I really like using the encryption class as it saves me from having to build my own obfuscation. However it doesn't support serialized objects.

Here is a quick and dirty change I've made to allow me to pass serialized objects to it.

Add these 2 functions to encryption_class
  /******************************************************
     * Added by Dave Robertson <http://www.softelephant.com
     *******************************************************/
function remove_key_chars($val)
{
  $temp = str_replace("\"","@@DBLQOUTE@@",$val);
  $temp = str_replace("\'","@@SGLQOUTE@@",$temp);
  $temp = str_replace("\\","@@SLASH@@",$temp);
  return $temp;
}

function replace_key_chars($val)
{
  $temp = str_replace("@@DBLQOUTE@@","\"",$val);
  $temp = str_replace("@@SGLQOUTE@@","'",$temp);
  $temp = str_replace("@@SLASH@@","\\",$temp);
  return $temp;
}



Then modify encrypt to have at the start
function encrypt ($key, $source, $sourcelen = 0)
// encrypt string into a garbled form
{
$source = $this->remove_key_chars($source);
...


and modify decrypt to have at the end

...
$target =  $this->replace_key_chars($target);
return rtrim($target);
} // decrypt


I've attached a modified version of the file Smile

Nothing super complicated but figured it might save some people some time in the future.
-Dave Razz
Re: std.encryption.class.inc [message #814 is a reply to message #813] Wed, 09 May 2007 04:16 Go to previous message
AJM is currently offline  AJM
Messages: 2368
Registered: April 2006
Location: Surrey, UK
Senior Member
Thank you for your contribution, but please be aware that the encryption routine was designed specifically to deal with passwords, so its use with anything else is not supported.

Previous Topic: Business Process Mangement and Rules
Next Topic: path generalization
Goto Forum:
  


Current Time: Sat Nov 23 08:13:53 EST 2024

Total time taken to generate the page: 0.03305 seconds