473,388 Members | 1,277 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

phpmyadmin's blowfish / mcrypt

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 to phpmyadmin '/libraries/blowfish.php'; */
$secret = 'secret';
$string = 'test string';
$iv = blah;
$encrypted = PMA_blowfish_encrypt($string,$secret);
$decrypted =
trim(mcrypt_decrypt(MCRYPT_BLOWFISH,$secret,base64 _decode($encrypted),MCRYPT_MODE_CBC,$iv));
echo $decrypted;

will output something like
test strÙÚE¦ô<qÕ

Anyhow, how do I make these two interchangeable?

Jul 17 '05 #1
1 9017
BKDotCom wrote:
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 to phpmyadmin '/libraries/blowfish.php'; */
$secret = 'secret';
$string = 'test string';
$iv = blah;
$encrypted = PMA_blowfish_encrypt($string,$secret);
$decrypted =
trim(mcrypt_decrypt(MCRYPT_BLOWFISH,$secret,base64 _decode($encrypted),MCRYPT_MODE_CBC,$iv)); echo $decrypted;

will output something like
test strÙÚE¦ô<qÕ

Anyhow, how do I make these two interchangeable?


Last time I played around with PHP mcrypt to any extenet I found that the
mcrypt functions were returning C type strings (terminated by '\0') for the
decryption.

Only getting partial output suggests that it may be a string termination
issue somewhere, but you're getting the key right.

I must admit to being rather in the dark regards IVs, but if you're not
supplying one to PMA_Blowfish_encrypt() why do you need one for
mcrypt_decrypt()? (it's optional anyway for CBC). Bearing in mind the issue
regarding C strings and the recommended use of mcrypt_enc_get_iv_size(),
I'd suggest that it is not only advisable to avoid using it for now, it may
even be the source of the error.

HTH

C.

Jul 17 '05 #2

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

Similar topics

2
by: Matt McKay | last post by:
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...
4
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...
2
by: Hal Vaughan | last post by:
I have no background in encryption, so I'm working with samples I've found in various places and patching them together. I know Blowfish can use a 56 byte key. The version of this program in Perl...
1
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...
5
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...
2
by: Claus Wanner | last post by:
Hi NewsGroup, some days ago i've started to coding an decryting function to decyrpt a Passwort. The password is BlowFish encrypted and than Base64 encodet. An other application send the...
0
by: Peter | last post by:
A while back I saw the posting for this blowfish application. I was wondering if anyone knows if this implementation is over 448 bits? http://www.todd.acheson.com/Blowfish.NET.zip
2
by: Derrick | last post by:
Has anyone been able to get blowfish decryption working from C#, in 1.1? I found sourcecode for 2.0, but there is enough 2.0 specific code in there that I'm trying to find a 1.1 library. ...
3
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...

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.