Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Crypt-Rijndael CPAN distribution.

Report information
The Basics
Id: 769
Status: resolved
Priority: 0/
Queue: Crypt-Rijndael

People
Owner: bdfoy [...] cpan.org
Requestors: wmorga13 [...] calvin.edu
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)

Attachments


Subject: Output from decrypt() behaves strangely under very specific circumstances
OK, this is one of the weirdest things I've ever seen. In the attached file is a Perl script that *should* print "116,101,115,116" to screen from the print statement on line 19. It should do this because line 17 contains a substitution that should get rid of all the null characters that are at the end of the string after it gets returned from decrypt() (and are printed from the print statement on line 16). However, when this is done in a subroutine, and when the scalar $key has 'my' in front of it, it doesn't work. It's like $plaintext is immutable under these conditions. But, if you remove the 'my' from $key on line 5, it will start working. Or, if you put all the code in mySub into the main body of the program, that will make it work too. I have no idea what could be causing this. I have tested this on two different machines. One is a PC running Debian GNU/Linux i386 woody (kernel 2.4.18) with the latest Crypt::Rijndael from CPAN on Perl version 5.6.1. The other is Debian GNU/Linux powerpc sid (kernel 2.4.19-pre4) running Crypt::Rijndael from the Debian package libcrypt-rijndael-perl on Perl version 5.6.1.
Download rijndaelbug.pl
text/x-perl 486b
#!/usr/bin/perl use Crypt::Rijndael; my $key = "a" x 32; my $cipher = new Crypt::Rijndael $key, Crypt::Rijndael::MODE_CBC; mySub(); sub mySub { my $encryptedData = "eeb1fabf451aa59252003bdd6d568357"; my $encryptedData = pack("H*", $encryptedData); my $plaintext = $cipher->decrypt($encryptedData); print $plaintext,"\n"; print join(',', unpack 'C*', $plaintext),"\n"; $plaintext =~ s/\x00+$//; print $plaintext,"\n"; print join(',', unpack 'C*', $plaintext),"\n"; }
From: Jeff Mott
Download (untitled) / with headers
text/plain 507b
For some reason it seems that the last byte isn't being read as a null byte (even though it is). For example chop $plaintext; $plaintext =~ s/\x00+$//; will work. Or there is some character (which doesn't exists) at the end acting as a boundry between the 0x00 string and the string termination. For example $plaintext =~ s/\x00+//; will work. However, whether $key has my or not and whether you used the sub or not didn't make any difference at my end. At any rate it has made the weird-shit list.
Download (untitled) / with headers
text/plain 1.2k
On Fri Jun 21 01:44:17 2002, guest wrote: Show quoted text
> OK, this is one of the weirdest things I've ever seen. In the attached > file is a Perl script that *should* print "116,101,115,116" to screen > from the print statement on line 19. It should do this because line 17 > contains a substitution that should get rid of all the null characters > that are at the end of the string after it gets returned from > decrypt() (and are printed from the print statement on line 16). > However, when this is done in a subroutine, and when the scalar $key > has 'my' in front of it, it doesn't work. It's like $plaintext is > immutable under these conditions. But, if you remove the 'my' from > $key on line 5, it will start working. Or, if you put all the code in > mySub into the main body of the program, that will make it work too. I > have no idea what could be causing this. I have tested this on two > different machines. One is a PC running Debian GNU/Linux i386 woody > (kernel 2.4.18) with the latest Crypt::Rijndael from CPAN on Perl > version 5.6.1. The other is Debian GNU/Linux powerpc sid (kernel > 2.4.19-pre4) running Crypt::Rijndael from the Debian package libcrypt- > rijndael-perl on Perl version 5.6.1.
This issue has been fixed in 1.13. Closing :-) Leon


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.