# Ruby openssl problem

**URL:** <https://www.ruby-forum.com/t/ruby-openssl-problem/63616>\
**Category:** Ruby\
**Created:** [June 16, 2006, 6:17pm UTC](https://www.ruby-forum.com/t/ruby-openssl-problem/63616 "2006-06-16T18:17:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Silva](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Ed\_Silva](https://www.ruby-forum.com/u/Ed_Silva)\
**Post date:** [June 16, 2006, 6:17pm UTC](https://www.ruby-forum.com/t/ruby-openssl-problem/63616/1 "2006-06-16T18:17:21Z")

</div>

Hi all,

I have run into a problem using the ruby openssl module to do  
blowfish encryption.

I have found that messages encrypted in ruby can de decrypted by  
ruby, but messages encrypted in perl or php cannot be decrypted by  
ruby, and visa versa. The perl and php scripts have no problem with  
each others messages, so I am wondering if there is anything specific  
I could be doing wrong.

Can anyone comment of the following code:

require ‘openssl’  
require ‘base64’

blowfish = OpenSSL::Cipher::Cipher.new(‘BF-ECB’)  
blowfish.encrypt(“somekey”)  
msg = blowfish.update(“hello world”)  
msg \<\< blowfish.final  
b64 = Base64.encode64(msg)

The base64 encoded message can be decoded in ruby by reversing the  
process, but the same data send to php or perl fails to decrypt.

Can anyone shed any light on this?

Cheers,

–Ed
