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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |