Skip to content

Instantly share code, notes, and snippets.

@alfrekjv
Created March 1, 2012 18:04
Show Gist options
  • Save alfrekjv/1951734 to your computer and use it in GitHub Desktop.
Save alfrekjv/1951734 to your computer and use it in GitHub Desktop.
Symmetric Encryption
<?php
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