summaryrefslogtreecommitdiffstats
path: root/admin/WebConsole/clases/EncripDescrip.php
blob: 4752c8adf7eb73ee27e62f952a77ee8587da3827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/*================================================================================
	Clase para encriptar y desencriptar cadenas 
================================================================================*/
class EncripDescrip{
	var $cadena;					// La cadena encriptada o desencriptada que ser�devuelta
	var $clave;						// La clave de la cadena  encriptada o desencriptada que ser�devuelta
	//________________________________________________________________________________________
	//
	//  Constructor
	//________________________________________________________________________________________
	function __construct($clave=12){
		$this->cadena="";
		$this->clave=$clave;
	}
	// ____________________________________________________________________________
	//
	//		Encripta una cadena 
	//_____________________________________________________________________________
	function Encriptar($cadena){
		
		return( $cadena);
		
		$clave=(int)$this->clave;
		$clave = (int)$clave  & 0xFF; 
		$lon=strlen($cadena);
		$this->cadena="";
		for($i=0;$i<$lon;$i++){
			$ch=(int)ord($cadena[$i]);
			$pot=(int)$ch^(int)$clave;
			$this->cadena.=chr($pot);
		}
		return( $this->cadena);
	}
	// ____________________________________________________________________________
	//
	//		Desencripta una cadena 
	//_____________________________________________________________________________
	function Desencriptar($cadena){
	
		return( $cadena);	
	
		$clave=(int)$this->clave;
		$clave = (int)$clave  & 0xFF; 
		$lon=strlen($cadena);
		$this->cadena="";
		for($i=0;$i<$lon;$i++){
			$ch=(int)ord($cadena[$i]);
			$pot=(int)$ch^(int)$clave;
			$this->cadena.=chr($pot);
		}
		return( $this->cadena);
	}
}