POK Flag Weirdness wth binary files

Discussion in 'Perl' started by Wayne Myers, May 26, 2004.

  1. Wayne Myers

    Wayne Myers Guest

    Hi,

    This week I got bitten by something very strange. I was writing
    code that needed to decrypt something encrypted using Rijndael
    encryption, but when I read the key in, for some reason, the
    Crypt::Rijndael module refused to accept the key as a valid
    scalar string.

    Digging around in the Crypt::Rijndael code and testing the string
    with Devel::peek revealed that no matter what method I used to
    read the key (a stream of random binary digits), the internal POK
    flag was not being set. Crypt::Rijndael explicitly tests the POK
    flag before accepting a key: this is why that was failing.

    However, I am not the first person to come across this problem,
    and found an extremely strange workaround here:

    http://groups.google.com/groups?hl=...seekm=&frame=off

    I have written a short script reproducing the problem (under Perl
    5.6.1 and Perl 5.8.3) and demonstrating the same workaround, here:

    http://www.waz.easynet.co.uk/pok/pok.pl.txt

    Is it a bug in Perl, a bug in Crypt::Rijndael, or a bug in my
    understanding of how to read in binary files?

    I'd be grateful if anyone could help me shed light on the matter

    Cheers etc.,

    Wayne

    --
    Wayne Myers
    http://www.waz.easynet.co.uk/
    Wayne Myers, May 26, 2004
    #1
    1. Advertising

  2. Wayne Myers

    ! aaa Guest

    Does the problem go away if you

    use bytes;
    no utf8;

    ???

    "Wayne Myers" <> wrote in message
    news:...
    > Hi,
    >
    > This week I got bitten by something very strange. I was writing
    > code that needed to decrypt something encrypted using Rijndael
    > encryption, but when I read the key in, for some reason, the
    > Crypt::Rijndael module refused to accept the key as a valid
    > scalar string.
    >
    > Digging around in the Crypt::Rijndael code and testing the string
    > with Devel::peek revealed that no matter what method I used to
    > read the key (a stream of random binary digits), the internal POK
    > flag was not being set. Crypt::Rijndael explicitly tests the POK
    > flag before accepting a key: this is why that was failing.
    >
    > However, I am not the first person to come across this problem,
    > and found an extremely strange workaround here:
    >
    >

    http://groups.google.com/groups?hl=...seekm=&frame=off
    >
    > I have written a short script reproducing the problem (under Perl
    > 5.6.1 and Perl 5.8.3) and demonstrating the same workaround, here:
    >
    > http://www.waz.easynet.co.uk/pok/pok.pl.txt
    >
    > Is it a bug in Perl, a bug in Crypt::Rijndael, or a bug in my
    > understanding of how to read in binary files?
    >
    > I'd be grateful if anyone could help me shed light on the matter
    >
    > Cheers etc.,
    >
    > Wayne
    >
    > --
    > Wayne Myers
    > http://www.waz.easynet.co.uk/
    ! aaa, May 27, 2004
    #2
    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. Guest
    Replies:
    1
    Views:
    537
    Matt Berther
    Apr 20, 2005
  2. Ranpha
    Replies:
    3
    Views:
    576
    Ranpha
    Apr 4, 2005
  3. Ben

    throw wth no operand

    Ben, Jan 9, 2004, in forum: C++
    Replies:
    2
    Views:
    331
  4. steve
    Replies:
    4
    Views:
    510
    Brian van den Broek
    Mar 13, 2005
  5. Wayne Myers

    POK Flag Weirdness wth binary files

    Wayne Myers, May 27, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    118
    Ben Morrow
    May 27, 2004
Loading...

Share This Page