You are here: Re: Classes in PHP « PHP Programming Language « IT news, forums, messages
Re: Classes in PHP

Posted by Jim Michaels on 02/07/06 22:06

I got this from the user notes in the manual.

A class to encrypt, decrypt data! if you have problems with using it please
visit my site http://www.alexandrub.tk and mail me using Contact section! I
use it to encrypt POST and GET data! I don't remember his name but thanks to
how recognize his code in the binFromHex function!
<?php
//copyright www.alexandrub.tk
//ver 1.00
class cript {
var $key;
var $td;
var $time4keyToChange;
var $iv;
function cript($aKey='time',$aTime4keyToChange=3600) { //constructor
$this->time4keyToChange=$aTime4keyToChange;
if($aKey!='time') {
$this->key=$aKey."&".intval(time()/$this->time4keyToChange);
} else {
$this->key=intval(time()/$this->time4keyToChange);
}
$this->td = MCRYPT_RIJNDAEL_256;
$this->iv = "qe3jigneqfrgnqw2egfmas4qetjkn5lg";
}
function hexFromBin($data) {
return bin2hex($data);
}
function binFromHex($data) {
$len = strlen($data);
return pack("H" . $len, $data);
}
function criptData($data) {
return $this->hexFromBin(mcrypt_encrypt($this->td, $this->key,
$data, MCRYPT_MODE_CBC, $this->iv));
}
function decriptData($eData) {
return trim(mcrypt_decrypt($this->td, $this->key,
$this->binFromHex($eData), MCRYPT_MODE_CBC, $this->iv));
}
}
return true;
?>

 

Navigation:

[Reply to this 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

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