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

Discussion in 'Perl Misc' started by uncle, Jun 14, 2007.

  1. uncle

    uncle Guest

    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)

    ~
     
    uncle, Jun 14, 2007
    #1
    1. Advertising

  2. uncle

    Guest

    uncle <> wrote in message-id: <>

    >
    >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.
     
    , Jun 14, 2007
    #2
    1. Advertising

  3. On Thu, 14 Jun 2007 20:53:02 -0000, uncle <> wrote:

    >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
    --
    {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
    (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
    ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
    256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
     
    Michele Dondi, Jun 16, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWlrZQ==?=
    Replies:
    0
    Views:
    994
    =?Utf-8?B?TWlrZQ==?=
    Aug 31, 2005
  2. sweety
    Replies:
    9
    Views:
    1,068
    Richard Heathfield
    Feb 7, 2006
  3. Replies:
    1
    Views:
    462
    Daniel Martin
    Jun 16, 2007
  4. Maran Chandrasekar

    Perl Encrypt / Ruby Decrypt

    Maran Chandrasekar, Feb 16, 2009, in forum: Ruby
    Replies:
    1
    Views:
    280
    Brian Candler
    Feb 16, 2009
  5. http://ejobseek.com

    Encrypt in Perl, De-encrypt in Javascript

    http://ejobseek.com, Sep 1, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    316
    James Willmore
    Sep 1, 2003
Loading...

Share This Page