Created
December 26, 2013 04:25
-
-
Save emayk/8129760 to your computer and use it in GitHub Desktop.
crypt exampl 2
This file contains hidden or 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 | |
//Listing 3: Encrypting Data Using the mcrypt_ecb Function | |
// source http://stackoverflow.com/questions/16600708/php-string-encrypt-and-decrypt | |
echo("<h3> Symmetric Encryption </h3>"); | |
$key_value = "KEYVALUE"; | |
$plain_text = "PLAINTEXT"; | |
$encrypted_text = mcrypt_ecb(MCRYPT_DES, $key_value, $plain_text, MCRYPT_ENCRYPT); | |
echo ("<p><b> Text after encryption : </b>"); | |
echo ( $encrypted_text ); | |
$decrypted_text = mcrypt_ecb(MCRYPT_DES, $key_value, $encrypted_text, MCRYPT_DECRYPT); | |
echo ("<p><b> Text after decryption : </b>"); | |
echo ( $decrypted_text ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment