• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 615
  • Last Modified:

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="MCtwzLQuwdQdhwhciKlhORtKO5K8g8HhA7JGMfpxs41Wtct7lVwHKw==" ;
$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?
0
merimax
Asked:
merimax
2 Solutions
 
fridomCEO/ProgrammerCommented:
0
 
fridomCEO/ProgrammerCommented:
0
 
btanExec ConsultantCommented:
this is another ref, do note blowfish need blocks of 8bytes or 64bits.

http://www.faqs.org/docs/gazette/encryption.html
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
ravenplCommented:
This Q is duplicate(rather renew) of http://www.experts-exchange.com/Security/Encryption/Q_26932519.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.
0
 
fridomCEO/ProgrammerCommented:
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
0
 
ravenplCommented:
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.
0
 
TolomirAdministratorCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now