PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mcrypt_enc_get_algorithms_name> <mcrypt_decrypt
Last updated: Fri, 04 Jul 2008

view this page in

mcrypt_ecb

(PHP 4, PHP 5)

mcrypt_ecb — Encripta/desencripta datos en modo ECB

Descripción

int mcrypt_ecb ( int $cipher , string $key , string $data , int $mode )

mcrypt_ecb() encripta o desencripta (dependiendo de mode ) los datos data con el cifrado cipher y la clave key en el modo de cifrado ECB y devuelve la cadena resultante.

El parámetro cipher es una de las constantes con nombre MCRYPT_nombrecifrado.

key es la clave suministrada al algoritmo. Debe guardarse en secreto.

data son los datos que serán encriptados/desencriptados.

mode es MCRYPT_ENCRYPT o MCRYPT_DECRYPT.

Ver también: mcrypt_cbc(), mcrypt_cfb(), mcrypt_ofb()



add a note add a note User Contributed Notes
mcrypt_ecb
andry at zionit dot ru
26-Aug-2007 02:52
<?php
   
function decrypt($value)
    {
        global
$LICENSE_KEY;

       
$key = substr(md5($_SERVER['REMOTE_ADDR']), 0, 6);
       
        if(
function_exists("mcrypt_ecb"))
        {
            return
mcrypt_ecb(MCRYPT_3DES, $key, $value, MCRYPT_DECRUPT);
        }
        else return
$value;
    }
   
   
// Расштфровка кукисов с использованием ключа
   
function encrypt($value)
    {
        global
$LICENSE_KEY;
       
       
$key = substr(md5($_SERVER['REMOTE_ADDR']), 0, 6);
       
        if(
function_exists("mcrypt_ecb"))
        {
            return
mcrypt_ecb(MCRYPT_3DES, $key, $value, MCRYPT_ENCRYPT);
        }
        else return
$value;
    }

?>

mcrypt_enc_get_algorithms_name> <mcrypt_decrypt
Last updated: Fri, 04 Jul 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites