Php Encrypt Decrypt Without Mcrypt

Mcrypt is deprecated, what is the alternative? As deprecated earlier; use mcrypt_encrypt and mcrypt_decrypt. Copy of php with mcrypt to decrypt the old data. As of PHP 7.1, the php-mcrypt was deprecated. And as of PHP 7.2 it was completely removed. This is a problem, since a number of server software titles still depend upon this encryption tool.

Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site. Note that the IV must be the same for mcrypt_encrypt and mcrypt_decrypt, otherwise you will have corrupted data after decryption. Pass it to php, and do it again. Mcrypt can be used to encrypt and decrypt using the above mentioned ciphers. If you linked against libmcrypt-2.2.x, the four important mcrypt commands. I could En/Decrypt within VB and PHP just fine But when I tried to encrypt one in VB and decrypt in PHP.

Active1 year, 4 months ago

I'm looking for a simple yet cryptographically strong PHP implementation of AES using Mcrypt.

Hoping to boil it down to a simple pair of functions, $garble = encrypt($key, $payload) and $payload = decrypt($key, $garble).

Kai Noack
7,2626 gold badges71 silver badges126 bronze badges
ChaseMoskalChaseMoskal
2,7392 gold badges19 silver badges37 bronze badges

4 Answers

Php Encryption Password

I'm recently learning about this subject, and am posting this answer as a community wiki to share my knowledge, standing to be corrected.

It's my understanding that AES can be achieved using Mcrypt with the following constants as options:

During encryption, a randomized non-secret initialization vector (IV) should be used to randomize each encryption (so the same encryption never yields the same garble). This IV should be attached to the encryption result in order to be used later, during decryption.

Results should be Base 64 encoded for simple compatibility.

Implementation:

Output looks like this:


Add function to clean control characters (�).

}

Dewa PutraDewa Putra
T.ToduaT.ToduaMcrypt
34.3k12 gold badges151 silver badges145 bronze badges

Class Mycrypt

Try using this class. Here. All you need to pass is key and string.

How To Use

Abhijit SrivastavaAbhijit Srivastava

Not the answer you're looking for? Browse other questions tagged phpencryptioncryptographyaesmcrypt or ask your own question.

Active5 months ago

in function need key to encrypt string without mcrypt libraly in php

in this not work for i character i test it

Php Encrypt Decrypt Password

Barry Wark
102k24 gold badges175 silver badges202 bronze badges
monkey_boysmonkey_boys
2,78320 gold badges51 silver badges81 bronze badges

5 Answers

This code is rather inefficient, I'm not surprised it doesn't give intended results.

Free

Tested and it appears to work fine for me.

Either way I feel I should warn you that this is a really insecure form of encryption, most passwords use the same sets of characters and a fairly small range of lengths, which makes this system very vulnerable to people being able to work out with a fairly good level of accuracy the password.

Php Encrypt Decrypt String

scragarscragar

Here's another method:

Encrypt And Decrypt Php

Again, don't expect this to be very secure.

jlogsdon

You can also try this:

or this:

or even this:

trantetrante
23k40 gold badges159 silver badges250 bronze badges

I used jlogsdon enc_encrypt and enc_decrypt in prestashop 1.4.4.1 to wrap encrypt and decrypt methods from Rijndael class, witch are using mcrypt. I didn'e check if enc_encrypt and enc_decrypt give exacly the same resulst as mcrypt_encrypt and mcrypt_decrypt, but they seem to work in prestashop 1.4.4.1. Thanks a lot.

tirianatiriana
5351 gold badge6 silver badges19 bronze badges

Php Encrypt Decrypt Without Mcrypt

The question is old but, as PHP 7 don't have mcrypt, I had the same problem. The best solution I found is using OpenSSL. It is built into PHP and you don't need any external library.

To encrypt:

To decrypt:

Php Encrypt Decrypt Without Mcrypt_rijndael_128

Reference link: https://www.shift8web.ca/2017/04/how-to-encrypt-and-execute-your-php-code-with-mcrypt/

Ariston CordeiroAriston Cordeiro

Php Encrypt Decrypt Without Mcrypt Php

Not the answer you're looking for? Browse other questions tagged phpencryption or ask your own question.