📄 20c02-2.php
字号:
<?php// Define our text, and our 'secret password'$text = "The market price of our stock will greatly increase next week dueto us releasing the fact that we have made 3 million dollars more than ouroriginal $300 profit estimate that we came up with.";$secret = "The sparrow flies at midnight";// Before encryption we need an Initialization Vector for the algorithm$ivsize = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);$iv = mcrypt_create_iv($ivsize, MCRYPT_RAND);// Now, encrypt this data using the Blowfish algorithm:$enc = mcrypt_encrypt(MCRYPT_BLOWFISH, $secret, $text, MCRYPT_MODE_ECB, $iv);// Let's echo out what the encrypted version looks like:echo "<p>Encrypted:<br />{$enc}</p>";// Generate a new Initialization Vector to decrypt it with.$niv = mcrypt_create_iv($ivsize, MCRYPT_RAND);// Now decrypt it again:$dec = mcrypt_decrypt(MCRYPT_BLOWFISH, $secret, $enc, MCRYPT_MODE_ECB, $niv);// Now display the decrypted versionecho "<p>Readable Again:<br />{$dec}</p>";?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -