merimax
asked on
blowfish convert from php to C with openssl
I have a very simple PHP script decrypting strings the way I need it to. It is as follows:
$p="password.sample" ;
$i="MCtwzLQuwdQdhwhciKlhOR tKO5K8g8Hh A7JGMfpxs4 1Wtct7lVwH Kw==" ;
$blowfish = new Crypt_Blowfish($p);
$output = $blowfish->decrypt(base64_ decode($i) );
I am trying to accomplish the above in C using openssl/blowfish but I am not able to get the correct combination of arguments set to make this happen. What would be the proper way to accomplish the above in C (linux) and openssl?
$p="password.sample" ;
$i="MCtwzLQuwdQdhwhciKlhOR
$blowfish = new Crypt_Blowfish($p);
$output = $blowfish->decrypt(base64_
I am trying to accomplish the above in C using openssl/blowfish but I am not able to get the correct combination of arguments set to make this happen. What would be the proper way to accomplish the above in C (linux) and openssl?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This Q is duplicate(rather renew) of https://www.experts-exchange.com/questions/26932519/openssl-blowfish-decryption.html
The comments You proposed to accept are merely C encryption tutorials, but do not explain the PHP - C differences in algo.
I would advise to delete it instead of forcing accept.
The comments You proposed to accept are merely C encryption tutorials, but do not explain the PHP - C differences in algo.
I would advise to delete it instead of forcing accept.
There is but one difference. PHP used an Object interface whereas you have to use the C interface on the C side. However AFAIKT all bigger c packages often used an opaque data pointer as first parameter and IIRC this is done in OpenSSL also.
Regards
Friedrich
Regards
Friedrich
fridom: I tried to decrypt the message with openssl and mcrypt - failed at all combinations. I also googled somewhere the information, that the incompatibility is because of different padding (and possibly IV calculation) used by php and openssl.
IMHO answer to this Q is showing the implementation differences, hence I gave up on that.
IMHO answer to this Q is showing the implementation differences, hence I gave up on that.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
http://www.codeproject.com/cpp/blowfish.asp