Ver Mensaje Individual
  #6 (permalink)  
Antiguo 23/06/2005, 16:35
Anarko
 
Fecha de Ingreso: febrero-2004
Mensajes: 1.987
Antigüedad: 20 años, 2 meses
Puntos: 22
A este hombre tampoco le fue muy bien...
Código PHP:
<? 
/* ----------------------------------------------- 
@Author: Developped by [email protected] 
@Site: http://www.EZScripts.net/ 
----------------------------------------------- 

How's the my encryption algorithm work: 

First it will generate an encryption key with the string you supply: 

Key 1 will be equal to the numerical value 
of each character in your crypt key. 

Key 2 will be equal to the length of your 
crypt key. 

For each character in the string you wish to encrypt, it will do the following mathematical calculations, where V is the final value of the encoded character and C is the value of the character currently encrypting: 

V = C * Key1 
V = V + Key2 

It will then separate each character in the original string with a character between 65 and 90 (cap. letters). 

To decrypt the string, it will do the opposite calculations, where V is the final value of the decrypted character and C is the value of the encrypted character: 

V = V / Key1 
V = C – Key2 */ 

/* ----------------------------------------------- 
@Name: Encrypt() 
@Args: $txt-> String to encrypt. 
@Args: $CRYPT_KEY -> String used to generate a encryption key. 
@Returns: $estr -> Encrypted string. 
----------------------------------------------- */ 

function encrypt($txt,$CRYPT_KEY){ 
if (!
$txt && $txt != "0"){ 
return 
false
exit; 


if (!
$CRYPT_KEY){ 
return 
false
exit; 


$kv keyvalue($CRYPT_KEY); 
$estr ""
$enc ""

for (
$i=0$i<strlen($txt); $i++){ 
$e ord(substr($txt$i1)); 
$e $e $kv[1]; 
$e $e $kv[2]; 
(double)
microtime()*1000000
$rstr chr(rand(6590)); 
$estr .= "$rstr$e"


return 
$estr


/* ----------------------------------------------- 
@Name: Decrypt() 
@Args: $txt-> String to decrypt. 
@Args: $CRYPT_KEY -> String used to encrypt the string. 
@Returns: $estr -> Decrypted string. 
----------------------------------------------- */ 

function decrypt($txt$CRYPT_KEY){ 
if (!
$txt && $txt != "0"){ 
return 
false
exit; 


if (!
$CRYPT_KEY){ 
return 
false
exit; 


$kv keyvalue($CRYPT_KEY); 
$estr ""
$tmp ""

for (
$i=0$i<strlen($txt); $i++) { 
if ( 
ord(substr($txt$i1)) > 64 && ord(substr($txt$i1)) < 91 ) { 
if (
$tmp != "") { 
$tmp $tmp $kv[2]; 
$tmp $tmp $kv[1]; 
$estr .= chr($tmp); 
$tmp ""

} else { 
$tmp .= substr($txt$i1); 



$tmp $tmp $kv[2]; 
$tmp $tmp $kv[1]; 
$estr .= chr($tmp); 

return 
$estr

/* ----------------------------------------------- 
@Name: keyvalue() 
@Args: $CRYPT_KEY -> String used to generate a encryption key. 
@Returns: $keyvalue -> Array containing 2 encryption keys. 
----------------------------------------------- */ 

function keyvalue($CRYPT_KEY){ 
$keyvalue ""
$keyvalue[1] = "0"
$keyvalue[2] = "0"
for (
$i=1$i<strlen($CRYPT_KEY); $i++) { 
$curchr ord(substr($CRYPT_KEY$i1)); 
$keyvalue[1] = $keyvalue[1] + $curchr
$keyvalue[2] = strlen($CRYPT_KEY); 

return 
$keyvalue


    
$a='asdqwe';
    echo 
encrypt($a,5);
    
$b='N0S0E0P0W0V0';
    echo 
'<hr>';
    echo 
decrypt($b,5);
exit;
?>
Si alguien lo entiende y puede corregirlo, por favor piblicarlo.