encrypt with perl, decrypt with ruby, 3 days and counting...

U

uncle

I have tried hundreds of combos, scanned hundreds of web pages, I
still cannot encrypt with perl and decrypt with ruby. Hell, I can't
even encrypt with perl/ruby and get the same result.

Have tried blowfish, tripledes, des, rc4, you name.

Would love an expert to help out !

Here is one of my many attempts


#===== PERL

#!/usr/bin/perl
use MIME::Base64;
use Crypt::CBC;
my $key = '12345678';
my $iv = '12345678';
my $text = '12345678';
$cipher = Crypt::CBC->new({
'literal_key' => 0,
'key' => $key,
'iv' => $iv,
'header' => 'none',
'padding' => 'standard',
'prepend_iv' => 0});
$encrypted = $cipher->encrypt($text);
$encoded = encode_base64($encrypted);
print "encrypted=$encrypted\n";
print "encoded=$encoded\n";

#===== RUBY

require 'openssl'
require "base64"
require 'cgi'
require 'uri'
key = "23456789"
token = "12345678"
e = OpenSSL::Cipher::Cipher.new 'DES'
e.encrypt key
s = e.update token
s << e.final
puts s
puts Base64.encode64(s)

~
 
Q

QoS

uncle said:
I have tried hundreds of combos, scanned hundreds of web pages, I
still cannot encrypt with perl and decrypt with ruby. Hell, I can't
even encrypt with perl/ruby and get the same result.

Have tried blowfish, tripledes, des, rc4, you name.

Would love an expert to help out !

Here is one of my many attempts


#===== PERL

#!/usr/bin/perl
use MIME::Base64;
use Crypt::CBC;
my $key = '12345678';
my $iv = '12345678';
my $text = '12345678';
$cipher = Crypt::CBC->new({
'literal_key' => 0,
'key' => $key,
'iv' => $iv,
'header' => 'none',
'padding' => 'standard',
'prepend_iv' => 0});
$encrypted = $cipher->encrypt($text);
$encoded = encode_base64($encrypted);
print "encrypted=$encrypted\n";
print "encoded=$encoded\n";

#===== RUBY

require 'openssl'
require "base64"
require 'cgi'
require 'uri'
key = "23456789"
token = "12345678"
e = OpenSSL::Cipher::Cipher.new 'DES'
e.encrypt key
s = e.update token
s << e.final
puts s
puts Base64.encode64(s)

~

Feel free to have a look at ShapeShifter on CPAN scripts, something
there may help you out somehow.

http://www.cpan.org/authors/id/Q/QO/QOS/Utilities/

It does seem to me that your key is different in these examples,
afaik the decrypt key needs to match the key used to encrypt.
 
M

Michele Dondi

I have tried hundreds of combos, scanned hundreds of web pages, I
still cannot encrypt with perl and decrypt with ruby. Hell, I can't

Crossposting is generally discouraged but by all means this is a
question that may have deserved it...


Michele
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top