Blowfish and Rails

R

rumz

I'm working on encrypting some data using blowfish. My Client uses php
and blowfish for encryption and i use ror and blowfish
the php snippet is as follows,

$key = 'some key';
$data = 'data to be encrypted'

$iv = pack('H*', substr($key, 0, 16));

$literak_key =", $key.$key.$key.substr($key,16),";
$cipher = mcrypt_module_open(MCRYPT_BLOWFISH, '', 'cbc', '');
mcrypt_generic_init($cipher, $literalKey, $iv);

When i try to do the same thing using rails, i get a different
encrypted key.

Also, blow fish can take only 56 byte key as its input, so i
manipulated the key as how its done in php and packed it to a hex.

however am not sure how i can pass the iv

blowfish = Crypt::Blowfish.new(key)
encrypted_string = blowfish.encrypt_block(plain_text)

any thoughts? thank you.

Cheers
Ramya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top