Questions tagged [mcrypt]

MCrypt, and the accompanying libmcrypt, are intended to be replacements for the old Unix crypt, except that they are under the GPL and support an ever-wider range of algorithms and modes. MCrypt has not been updated since 2007

MCrypt implements numerous cryptographic algorithms, mostly block ciphers and stream ciphers, some of which falls under export restrictions in the United States. Algorithms include , , arcfour, enigma, ghost, LOKI97, RC2, serpent, threeway, twofish, wake, XTEA

Caution

Please note that the MCrypt library has not been updated since 2007. The PHP project has moved to deprecate and ultimately remove MCrypt from the PHP core and other projects will likely follow suit. It is highly recommended you switch to OpenSSL or another maintained encryption project.

922 questions
3
votes
2 answers

PHP mcrypt_decrypt - can I determine if data is decrypted with the right key?

I'm working on a php script and are using mcrypt to encrypt/decrypt arbitrary data. When I decrypt encrypted data, using another key (e.g. I typed in the wrong password), the output won't be correctly decrypted of course. If the wrong key has been…
José
  • 391
  • 3
  • 14
3
votes
1 answer

Can't compile mcrypt (configure failed: mhash_keygen in -lmhash... no)

Problem solved by Shawn Chin in Answer 1. And what drives me crazy is that to compile mcrypt extension, only libmcrypt is enough, there is no need to compile mhash and mcrypt :( I want to compile mcrypt extension for php (RHEL5.1, Intel i5 650),…
felix021
  • 1,936
  • 3
  • 16
  • 20
3
votes
1 answer

Mcrypt library writing result to file

I'm trying to write encrypted data to a file. However, when reading it back into the program and trying to decrypt it, I only get garbage back out. Without writing it to a file it seems to work.. What am I doing wrong? Here's the code: MCRYPT td,…
Frank Vilea
  • 8,323
  • 20
  • 65
  • 86
3
votes
4 answers

Alternatives to Mcrypt for encryption / decryption in PHP?

I'm giving some code for a Drupal module that needs to do encryption and decryption. I dont think I can assume that the Mcrypt module is installed on the Drupal system. What can i use as an alternative encryption mechanism? This isnt for financial…
siliconpi
  • 8,105
  • 18
  • 69
  • 107
3
votes
2 answers

Mcrypt Output - Lowercase Only?

Is it possible to specify a lowercase only output when using Mcrypt? This is a sample of my code used to encrypt: public function encode($value){ if(!$value){return false;} $text = $value; $iv_size =…
Kit
  • 4,095
  • 7
  • 39
  • 62
3
votes
1 answer

Decrypting an mcrypt file in .Net (C#)

I've been a C# hobbyist for some time now and would consider having intermediate development skills, but little to no encryption knowledge. As part of a side project I need to decrypt files that were encrypted using MCrypt. It doesn't seem any…
jjames
  • 1,391
  • 1
  • 10
  • 10
3
votes
1 answer

php:5-apache mcrypt.h not found

I work on some old project (Laravel 4.2) which use mcrypt and php5 and wanna run it on docker. Here is my dockerfile: FROM php:5-apache COPY --from=composer:latest /usr/bin/composer /usr/bin/composer RUN apt-get update &&\ apt-get install -y…
Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
3
votes
2 answers

Encryption: Testing that a string is properly decrypted?

Here's a theoretical one that not only applies to PHP, but probably to more languages. Let's say that I encrypt a string with the mcrypt library using and the AES-256 cipher. The string, encrypted, would now look similar to…
Industrial
  • 41,400
  • 69
  • 194
  • 289
3
votes
1 answer

Install mcrypt on mac php7.2 MAMP

I tried following most of the tutorials here on stack overflow but got no success. Issue in installing…
avlz
  • 35
  • 1
  • 10
3
votes
0 answers

php sample code uses mcrypt which is no longer available in php72

I can see that the sample php code uses mcrypt. Can we expect that sagepay will re-write the php sample code to use open_ssl instead, or perhaps someone has already done it? Ok, as I've had no response to this, I've tried to find out how to replace…
brian read
  • 31
  • 3
3
votes
1 answer

Install php5-mcrypt on Ubuntu

I want to install the mcrypt on vagrant machine. The OS is Ubuntu. Which is the command?
Lluís Puig Ferrer
  • 1,128
  • 7
  • 19
  • 49
3
votes
2 answers

PHP convert MCRYPT_ENCRYPT to OPENSSL_ENCRYPT (SOAP header)

I need to encrypt some SOAP header fields, and I currently have the following code working in a project with PHP 5.6 version. function getBaseEncoded($data, $key) { $size = $this->pkcs5_pad($data, mcrypt_get_block_size(MCRYPT_RIJNDAEL_128,…
Linesofcode
  • 5,327
  • 13
  • 62
  • 116
3
votes
1 answer

How safe is mcrypt encoding

I have two functions and a random generated key: function encode ($a) { $key = "7HLgdzXyaTaZuTss6xayLk3qLTJ2jsRLgPnMzpNwhwnEZsnHUfHxfYW5r3sQcZsC"; $aEncoded =…
Simon Pannek
  • 41
  • 1
  • 6
3
votes
5 answers

Openssl equivalent to mcrypt_get_block_size

I am currently in the process of replacing Mcrypt with OpenSSL since Mcrypt will be deprecated in PHP 7.1. I need is a way to get the blocksize per algorithm like mcrypt_get_block_size(). I am wondering if there is an equivalent function to…
herriekrekel
  • 571
  • 6
  • 15
3
votes
2 answers

PHP AES encryption... no idea what I'm doing

I don't know much about encryption, but I was able to get AES working in PHP... somewhat. Here are a couple functions that I am using: function aes_decrypt($val,$ky) { $key="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; …
Brad
  • 159,648
  • 54
  • 349
  • 530