473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

mcrypt not working

I've written a php page which allows users to type in a text string and a
key, then choose from a dropdown menu of encryption/decryption cyphers, and
a method (encrypt, decrypt).

The whole thing works, except the mcrypt command doesn't work.

here is my mcrypt command:
if ($method == 0) {
//Encrypt
$output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_ENCRYPT) ;
} else {
//Decrypt
$output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_DECRYPT) ;
}

Here's a list of what the variables may be:
$algorithm = MCRYPT_3DES
$key = "plain text"
$input = "more plain text"

if you want, I can upload a .txt containing the whole php file.

Thanks! :)
Jul 17 '05 #1
2 3297
Matt McKay:
I've written a php page which allows users to type in a text string and a
key, then choose from a dropdown menu of encryption/decryption cyphers,
and a method (encrypt, decrypt).

The whole thing works, except the mcrypt command doesn't work.


"Doesn't work" isn't really helpful :) Do you actually have support for the
mcrypt library in your PHP?

André Næss
Jul 17 '05 #2

"Matt McKay" <so*****@micros oft.com> wrote in message
news:D4******** ************@ne ws-server.bigpond. net.au...
I've written a php page which allows users to type in a text string and a
key, then choose from a dropdown menu of encryption/decryption cyphers, and a method (encrypt, decrypt).

The whole thing works, except the mcrypt command doesn't work.

here is my mcrypt command:
if ($method == 0) {
//Encrypt
$output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_ENCRYPT) ;
} else {
//Decrypt
$output = mcrypt_ecb ($algorithm, $key, $input, MCRYPT_DECRYPT) ;
}

Here's a list of what the variables may be:
$algorithm = MCRYPT_3DES
$key = "plain text"
$input = "more plain text"

if you want, I can upload a .txt containing the whole php file.

Thanks! :)


You need to let us know what you mean by "doesn't work"...

Either way - its been a while since I used the mcrypt functions, but when I
did, there were a few things I should (but hadn't done) and a newsposter
here guided me:

1 - Have you installed the mcrypt *development* library? Note, I had
installed libmcrypt on my box - I had *incorrectly* believed that the
development version of libmcrypt was sorta like an alpha or beta release -
It wasn't... Because I was programming, the development version has the
libraries that PHP would use when being compiled... Which leads me to my
last question...

2 - You did compile PHP with --with-mcrypt didn't you?

Hope that helps... its from memory but I believe it to be correct...

randelld
Jul 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2455
by: Marek Muszak | last post by:
Hello, I try use mcrypt but I want to use key in bytes, not in string. Encrypt text will be decrypt in Delphi with function where key is 16byte not string. How can I do this. Thanks for any help. best regards
0
1480
by: William Holroyd | last post by:
So I've got PHP to recognize mcrypt and pdflib in the phpinfo() output, but trying to use any of the functions fail with "...undefined function called..". There aren't any configurable files with either distro and neither mention php.ini settings need to be made. Restarting the apache server does not fix this and no errors are reported while...
1
9048
by: BKDotCom | last post by:
I'm writing an app that will use blowfish encryption.. PHP's mcrypt will be used if available. if not, I'll use PHPmyadmin's blowfish.php library. The problem is I can't figure out what initialization vector blowfish.php is useing (or if that's even my problem). ie, if I encrypt with blowfish.php and decrypt with mcrypt: /* include path...
4
28005
by: believein | last post by:
Hi all, I installed PHP thru the XAMPP package on my windows machine. The problem, I couldn't solve, is that the mcryppt funcs don't work. It return the following message: Call to undefined function mcrypt_decrypt() ... If I write a <?php echo ***";
1
2121
by: laredotornado | last post by:
Hello, My hosting company does not support the PHP mcrypt functions. Instead, they recomend using the command line, /usr/local/bin/mcrypt utility via PHP's exec method. Sadly, they do not provide any documentation how to do this. How would i translate the following function encryptString($p_str) { $iv_size =...
5
3056
by: sylvian stone | last post by:
Hi, I'm getting some strange errors that I cannot pin down: Warning: mcrypt_generic_init(): Iv size incorrect; supplied length: 7, needed: 8 in...... This is strange because the data is encrypted, inserted into the databse, then later retrieved and decrypted with the necessary hash and ivector keys.
0
1660
by: codearcher | last post by:
I have the latest version of XAMPP installed on Windows XP Pro SP2. I am trying to use mcrypt with rijnndael-128 on ecb: " $cr = mcrypt_module_open('rijndael-128','','ecb','') or die('<br><br>Could not open Module<br><br>'); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($cr), MCRYPT_RAND) or die('<br><br>Could not create iv<br><br>');...
0
2019
by: E. Recio | last post by:
Long story short. I want to use Mac OS/X and PHP. I have a db with passwords stored under Linux using the crypt("foo", "$1$".$salt."$); scheme. This means that crypt should execute a CRYPT_MD5 password hash. I know that Mac OS/X only supports the two DES'. So is there a way I can use mcrypt, or mhash or ANY library to reproduce php's CRYPT_MD5...
3
8762
by: =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?= | last post by:
Hi, I'm having a hard time getting python-mcrypt extension to build. I installed libmcrypt with --prefix=/usr and I checked that the library exists -rwxr-xr-x 1 root wheel 352K Sep 19 16:53 /usr/lib/libmcrypt. 4.4.8.dylib* lrwxr-xr-x 1 root wheel 21B Sep 19 16:53 /usr/lib/libmcrypt. 4.dylib@ -libmcrypt.4.4.8.dylib lrwxr-xr-x...
0
7612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3640
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1212
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.