-
-
Save NeftaliAcosta/f3e8129fd2619f774991b0c40d4c7adf to your computer and use it in GitHub Desktop.
encriptar y desencriptar MD5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function encriptar($texto){ | |
$key='palabraclaveparalacodificacionydecodificacion'; // Una clave de codificacion, debe usarse la misma para encriptar y desencriptar | |
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $cadena, MCRYPT_MODE_CBC, md5(md5($key)))); | |
return $encrypted; | |
}; | |
function desencriptar($texto){ | |
$key='farmaciajuntoati'; // Una clave de codificacion, debe usarse la misma para encriptar y desencriptar | |
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($cadena), MCRYPT_MODE_CBC, md5(md5($key))), "\0"); | |
return $decrypted; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment