Thanks for the post, you are helping to shed more light onto my problem.

The character string being generated is formed from a VB application, which the VB programmer has used this page as the source for the compiled code.

>the cipher text length is ALWAYS a multiple of 8

Although he acknowledges that he hasn't initially padded the blocks out to be in exact 8 bytes blocks - using the same function to reverse the data out works; I wonder if perhaps we have inherited someone else's bugs by including this code?

>you are decoding the multi-byte characters into a single byte

When encoding these characters, some single-byte characters are transformed into multi-byte characters, as per the example below.

126 %7E \x7E 127 %7F \x7F 128 %u20AC \x80 129 %81 \x81 130 %u201A \x82 131 %u0192 \x83 132 %u201E \x84 133 %u2026 \x85 134 %u2020 \x86 135 %u2021 \x87

In the example here, the character is transformed as a single byte character, so surely it must go back to a single (not multi) byte character?

>eg %u0160 should be something like "\x00\xBF"

I am not sure I fully understand what you have written here, is this the information I should be looking at?

>correct first few characters then the encryption is running in ECB mode and so Crypt::CBC won't help you

Yes, your statement is correct - I tried the Crypt::CBC module, but the outcoming data looked nothing like the original string, whereas the Crypt::Blowfish module was giving me the majority of it, just causing problems in the trailing area.

Richard (still mostly confused ...!)


In reply to Re: Re: Blowfish decryption problem by richard_mortimer
in thread Blowfish decryption problem by richard_mortimer

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.