mcrypt

cipher class and mcrypt_create_iv is slow at times

纵饮孤独 提交于 2019-12-05 01:02:52
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_decrypt(MCRYPT_RIJNDAEL_256, $this->securekey, base64_decode($input), MCRYPT_MODE_ECB)); } function

Enable Mcrypt on PHP Install

笑着哭i 提交于 2019-12-05 00:19:08
问题 I have PHP 5.2.14 installed on a Windows box (installed via .msi) using Apache 2.2.16. The install came with both ext/php_mcrypt.dll and libmcrypt.dll but when I uncommented extension=php_mcrypt.dll in php.ini and restarted Apache it doesn't enable. phpinfo() shows nothing for it. What am I missing? UPDATE: I looked at my error logs and it spit this out to me: PHP Warning: PHP Startup: Unable to load dynamic library 'C:\PHP5\ext\php_mcrypt.dll' - The specified module could not be found.\r\n

Decrypting PHP MCRYPT_RIJNDAEL_256 in Ruby

╄→гoц情女王★ 提交于 2019-12-04 16:38:15
I have a database filled with encrypted passwords that I need to decrypt in Ruby for a platform change. How can I port this PHP code to Ruby? Have tried to use OpenSSL in Ruby with AES_256 but getting 'Bad Decrypt' errors and also errors that my key ($salt) isn't long enough. In the example below, $salt is a 25 character string. This is the PHP decryption function: function decrypt_password($text, $salt) { return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))); }

Using PHP mcrypt with Rijndael/AES

霸气de小男生 提交于 2019-12-04 12:02:38
问题 I am trying to encrypt some text messages using mcrypt from php and the cipher Rijndael, but I am not sure about the MCRYPT_MODE_modename (according to PHP's manual these are available "ecb", "cbc", "cfb", "ofb", "nofb" or "stream" but I read there are actually a few more). I have no idea what each one do or how to use them. I read two things, that ECB mode should not be used and MCRYPT_RAND neither. They didn't explain why. For the ECB mode I guess it's because it always generate the same

Delphi DEC library (Rijndael) encryption

前提是你 提交于 2019-12-04 11:34:58
问题 I am trying to use the DEC 3.0 library (Delphi Encryption Compedium Part I) to encrypt data in Delphi 7 and send it to a PHP script through POST, where I am decrypting it with mcrypt (RIJNDAEL_256, ECB mode). Delphi part: uses Windows, DECUtil, Cipher, Cipher1; function EncryptMsgData(MsgData, Key: string): string; var RCipher: TCipher_Rijndael; begin RCipher:= TCipher_Rijndael.Create(KeyStr, nil); RCipher.Mode:= cmECB; Result:= RCipher.CodeString(MsgData, paEncode, fmtMIME64); RCipher.Free;

PHP 7.2 with mcrypt in Windows

天大地大妈咪最大 提交于 2019-12-04 09:42:05
There are some huge legacy systems whose dependencies on PHPs' mcrypt are extremely important and vital (including the data storage in database). I need to find a way to maintain this library while upgrading to PHP 7.2 (which already worked fine). My local test environment is Windows. The live environment is run on CentOS. Some of the answers I have seen is decrypting and change mcrypt to openssl ( I think that's not possible at the moment since there's a lot of data to decrypt ). Another way lights to download a lower PHP version with mcrypt -support, copy the extension and add it to php.ini

Encryption: Use of initialization vector vs key?

笑着哭i 提交于 2019-12-04 09:01:10
问题 I am using PHP's mcrypt library and the AES-256 (rijndael) algorithm, which requires both a key + initialization vector to run. My logical brainside isn't really going along with this. Isn't just one key enough? Theoretical scenario: If I had encrypted sensitive data stored in a database, which only the owner should be able to decrypt, would it be appropriate to use the users hashed password to either the key or the initialization vector to his or her data? Should the key be considered more

can't create a Laravel project because mcrypt extension is missing

南笙酒味 提交于 2019-12-04 06:29:11
OK, I have seen many posts about this, and I have spent the entire day working through them to solve this issue, with no success. I am trying to create a Laravel project. I am using a Mac (Yosemite), which is running PHP 5.5.14. There is also an older version of PHP on the machine. When I try to create a project from the command line using "laravel new projectname ", no errors are reported, but the command just creates an empty folder named with the project name. I get the "Crafting application..." and "Application ready! Build something amazing" messages but, again, only an empty folder. If I

mcrypt warning on update to php 5.6.2; Key of size x not supported

左心房为你撑大大i 提交于 2019-12-04 03:28:01
问题 We are getting the following warning after updating from PHP 5.5.18 to PHP 5.6.2: mcrypt_decrypt(): Key of size 20 not supported by this algorithm. Only keys of sizes 16, 24 or 32 supported The encryption algorithm appeared to work fine before this: $decrypttext = mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $this->keys[$key_label], $crypttext, MCRYPT_MODE_ECB, $iv ); It would be a major pain to have to re-encrypt everything, is there something I can pad the key with so that it works the same way as

Moving from mcrypt with Blowfish & ECB to OpenSSL

半腔热情 提交于 2019-12-04 03:25:29
问题 In the (not too distant) past a decision has been made (by someone who longer works here) to always 'encrypt' database IDs to something else, on the fly, whenever it was needed for external communication. Now, we've moved from PHP 5.x to PHP 7.0 for our main application, and our microservices scattered across our infrastructure are running either 7.0 or 7.1. The 7.1 servers keep throwing deprecation warnings for the mcrypt stuff. No biggie, just yet. But with PHP 7.2 around the corner, we