473,544 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_en crypt($string,$ secret);
$decrypted =
trim(mcrypt_dec rypt(MCRYPT_BLO WFISH,$secret,b ase64_decode($e ncrypted),MCRYP T_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 9037
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_en crypt($string,$ secret);
$decrypted =
trim(mcrypt_dec rypt(MCRYPT_BLO WFISH,$secret,b ase64_decode($e ncrypted),MCRYP T_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_en crypt() 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
3294
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 works, except the mcrypt command doesn't work. here is my mcrypt command: if ($method == 0) { //Encrypt $output = mcrypt_ecb ($algorithm, $key,...
4
28002
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 ***";
2
10158
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 has no problem with a 56 byte key, but this Java version has problems if I use a key that is any length other than 8 bytes. Is there something I...
1
2116
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
3054
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.
2
2939
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 password to me in this form. Note: A java-application encrypt and encode the password and send it to my application about an HTTP-Request (intranet,...
0
1066
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
4484
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. Thanks in advance! Derrick
3
8759
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
7387
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
7798
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
7405
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...
0
5956
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5316
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
3441
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1862
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
688
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.