mcrypt_encrypt fails to initialise

Posted by mixkat on Stack Overflow See other posts from Stack Overflow or by mixkat
Published on 2012-09-04T15:16:36Z Indexed on 2012/09/04 15:38 UTC
Read the original article Hit count: 199

Filed under:
|
|
|

I am trying to encrypt some data in PHP using the Rijndael cipher in CBC mode with a 256bit key but for some reason I get the following error message:

mcrypt_encrypt() Module initialization failed

My code:

    $hashKey = hash('sha256',$key);
    $iv = hash('sha256',$hashKey);

    //                                                 ------Cipher-------------key-------------Data-------------Mode---------IV--
    $encryptedQuestion = base64_encode(mcrypt_encrypt('MCRYPT_RIJNDAEL_256', $hashKey , $_POST['question'], MCRYPT_MODE_CBC, $iv));

Can anyone see whats wrong with this?

© Stack Overflow or respective owner

Related posts about php

Related posts about encryption