Skip to content

Instantly share code, notes, and snippets.

@run26kimo
Created April 19, 2012 02:34
Show Gist options
  • Save run26kimo/2417960 to your computer and use it in GitHub Desktop.
Save run26kimo/2417960 to your computer and use it in GitHub Desktop.
mcrypt_ecb
<?php
$key = "admlX71MbBLlEznv";
$text = "fleshwound is a farmer,deadly wounded ";//明文
$ctext = base64_encode (mcrypt_ecb (MCRYPT_3DES, $key, $text, MCRYPT_ENCRYPT) ); //加密
$ptext = mcrypt_ecb (MCRYPT_3DES, $key,base64_decode($ctext), MCRYPT_DECRYPT); //解密
echo "明文:$text <br> 密文:$ctext <br>解密后明文:$ptext"
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment