mcrypt

`mcrypt_create_iv` Stalls, But Only Through Apache

丶灬走出姿态 提交于 2019-12-24 03:52:40
问题 My local installation of PHP started doing this recently, but I don't know what changed and could have started this. It completely stalls out with 100% CPU utilization when I call mycrypt_create_iv , but only when that's called by Apache. When I call it from the CLI, it returns almost instantly. My test file is as follows: <?php echo mcrypt_create_iv(16, MCRYPT_DEV_URANDOM); The values are, of course, what the function was getting called with when I discovered this issue. This issue happens

php mcrypt CBC mode encryption/decryption problem

大憨熊 提交于 2019-12-23 12:27:41
问题 I have a problem with CBC mode when I try to encrypt/decrypt some text using php's mcrypt extension. I've created a class to perform this operations, it works fine with other modes but CBC. The problem is as follow: I use the clear text Even in cryptography, silence is golden . I do the encryption part, no problem till this point. But each time I try to decrypt, I get something like this: 9��'t"�cryptography, silence is golden . As you can see, the first 8 characters of the text are wrong. I

What's the difference between Blowfish and Blowfish-compat?

爱⌒轻易说出口 提交于 2019-12-23 11:48:10
问题 I can't seem to find a source for the differences. I've found this difference in this online decryption tool http://www.tools4noobs.com/online_tools/decrypt/ I have some encrypted Blowfish data that I'm trying to decrypt through Python's PyCrypto module. The problem, however, is that the data seems to be encrypted with "blowfish-compat", as that's what it takes to decrypt it through the online tool; I can't decrypt it through PyCrypto's module, and I'm gathering that it uses strictly Blowfish

What's the difference between Blowfish and Blowfish-compat?

荒凉一梦 提交于 2019-12-23 11:47:59
问题 I can't seem to find a source for the differences. I've found this difference in this online decryption tool http://www.tools4noobs.com/online_tools/decrypt/ I have some encrypted Blowfish data that I'm trying to decrypt through Python's PyCrypto module. The problem, however, is that the data seems to be encrypted with "blowfish-compat", as that's what it takes to decrypt it through the online tool; I can't decrypt it through PyCrypto's module, and I'm gathering that it uses strictly Blowfish

What's needed for PHP's mcrypt_decrypt()?

无人久伴 提交于 2019-12-23 10:41:05
问题 I have a script that uses mcrypt_decrypt() function, but I get the following error Fatal error: Call to undefined function mcrypt_decrypt() What modules/libraries do I need to include to use this function? Or is there another reason I'm getting the error? Thanks 回答1: Please see: Mcrypt Requirements Mcrypt Installation You need to compile your PHP with --with-mcrypt[=DIR] and have libmcrypt Version 2.5.6 or greater on your machine. 回答2: sudo apt-get install php5-mcrypt works on ubuntu. 回答3:

Encrypted data in URLs

跟風遠走 提交于 2019-12-23 09:55:46
问题 I am developing a PHP application to manage orders for a company. To view an order the URL is currently /orders/view/3502 . I don't want the order ID number to appear in the URL, so I used CodeIgniter's encrypt library to encrypt the ID in the URL. The URL (after encryption) looks like /orders/view/AaffGdQQ . The problem I am having is sometimes the encrypted ID contains a forward slash or a plus sign, which don't work correctly when in a URL. CodeIgniter reads the URL based on slashes, so,

Decrypting data with openssl commandline tool

守給你的承諾、 提交于 2019-12-22 11:28:56
问题 I have to following code and as far as I know it is correct, but it does not work. I am trying to encode data with PHP's Mcrpyt and then decode it with the openssl commandline tool. This is my PHP code: /* * Convert a normal ascii string to a hexadecimal string. * Complement of hexToString(). */ function stringToHex($str) { $hex_str = ""; for ($i = 0; $i < strlen($str); ++$i) { $hex_str .= sprintf("%02X", ord($str[$i])); } return $hex_str; } $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT

mcrypt_encrypt not working properly on PHP 5.6.9

拥有回忆 提交于 2019-12-22 06:58:31
问题 I have the following code which worked fine on PHP 5.5.9. function index() { echo $this->encryptText_3des('TEST','JHHKJH9879'); } function encryptText_3des($plainText, $key) { $key = hash("md5", $key, TRUE); for ($x=0;$x<8;$x++) { $key = $key.substr($key, $x, 1); } $padded = $this->pkcs5_pad($plainText, mcrypt_get_block_size(MCRYPT_3DES, MCRYPT_MODE_CBC)); $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_3DES, $key, $padded, MCRYPT_MODE_CBC)); return $encrypted; } function pkcs5_pad ($text,

Why does something encrypted in PHP not match the same string encrypted in Ruby?

筅森魡賤 提交于 2019-12-22 05:09:25
问题 Here are my requirements: I need to encrypt a string in PHP using AES encryption (including a random iv), Base64 encode it, then URL-encode it so that it can be passed as a URL parameter. I am trying to get the same result in both PHP and Ruby, but I can't make it work. Here is my PHP code: function encryptData($data,$iv){ $cipher = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, ''); $iv_size = mcrypt_enc_get_iv_size($cipher); if (mcrypt_generic_init($cipher,

cipher class and mcrypt_create_iv is slow at times

亡梦爱人 提交于 2019-12-22 03:22:56
问题 I am having an issue with my cipher class. At times it is very fast. Sometimes however it is slow. the code Im using is as follows class Cipher { private $securekey, $iv; function __construct() { $this->securekey = hash('sha256','51(^8k"12cJ[6&cvo3H/!2s02Uh46vuT4l7sc7a@cZ27Q',TRUE); $this->iv = mcrypt_create_iv(32); } function encrypt($input) { return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->securekey, $input, MCRYPT_MODE_ECB)); } function decrypt($input) { return trim(mcrypt