Where did you get that initial encrypted packet from? If I use the following code instead, it shows that Crypt::Blowfish can do the round trip fine:

use Crypt::Blowfish; $blowfishkey=pack("H*",'5b3b272e5d39342d33313d3d2d252640215e2b5d00'); $p1 = "\x00WildMaN"; $cipher = new Crypt::Blowfish $blowfishkey; print "Key: $blowfishkey\n"; print "Plaintext packet: $p1\n"; $p2 = $cipher->encrypt($p1); print "Encrypted packet: $p2\n"; $p3 = $cipher->decrypt($p2); print "Decrypted back to: $p3\n";

Results:

Key: [;'.]94-31==-%&@!^+]. Plaintext packet: .WildMaN (00 57 69 6c 64 4d 61 4e) Encrypted packet: ..Y..D.. (02 b2 59 1f f3 44 86 aa) Decrypted back to: .WildMaN (00 57 69 6c 64 4d 61 4e)

Maybe your problem lies in the way the key is used to initialise the S-boxes, done in Crypt::Blowfish by the C function blowfish_make_bfkey() in _blowfish.c. But I don't know how you'd track down the difference short of analysing the code for this implementation, and comparing to the code in the Java and C# implementations.

Hugo


In reply to Re: Rountrip through Crypt::Blowfish corrupts data? by hv
in thread Rountrip through Crypt::Blowfish corrupts data? by wildmandnd

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.