Reply to Re: [PHP] Data Enryption

Your name:

Reply:


Posted by Greg Donald on 10/04/49 11:05

On Wed, 12 Jan 2005 10:13:08 -0000, Shaun <shaunthornburgh@hotmail.com> wrote:
> I have site that allows users to upload private information to our server.
> We would like to encrypt the data for security reasons and only allow
> certain users to be able to un-encrypt the data and view it. I have looked
> at the PHP encryption functions and they appear to be one way algorithms - I
> am guessing this is the whole point of encrption ;)
>
> Does anyone have any suggestions regarding this?

function encrypt( $string )
{
$key = '&g1@8477Fg9*';

$result = '';

for( $i = 1; $i <= strlen( $string ); $i++ )
{
$char = substr( $string, $i - 1, 1 );

$keychar = substr( $key, ( $i % strlen( $key ) ) - 1, 1 );

$char = chr( ord( $char ) + ord( $keychar ) );

$result .= $char;
}

return $result;
}

function decrypt( $string )
{
$key = '&g1@8477Fg9*';

$result = '';

for( $i = 1; $i <= strlen( $string ); $i++ )
{
$char = substr( $string, $i - 1, 1 );

$keychar = substr( $key, ( $i % strlen( $key ) ) - 1, 1 );

$char = chr( ord( $char ) - ord( $keychar ) );

$result .= $char;
}

return $result;
}


--
Greg Donald
Zend Certified Engineer
http://destiney.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация