Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This code works fine for a single charcter:use strict; use warnings; use Tk; use Crypt::CBC; my $plaintext; my $mw = MainWindow->new(); my $password_e = $mw->Entry( -textvariable => \$plaintext, -show => '*', -width => '10' )->pack( -side => 'top'); my $password_b = $mw->Button( -text => "Encrypt", -width => '13', -command => \&encrypt )->pack( -side => 'top', -pady => 10 ); sub encrypt { my $key = pack("H16", "0123456789ABCDEF"); print("$plaintext\n"); my $cipher = Crypt::CBC->new( -cipher => 'DES', -key => $key, ); my $ciphertext = $cipher->encrypt($plaintext); print("$ciphertext\n"); my $recovered = $cipher->decrypt($ciphertext); print("$recovered\n"); } MainLoop
Any idea why?my $plaintext = 'P'; my $key = pack("H16", "0123456789ABCDEF"); print("$plaintext\n"); my $cipher = Crypt::CBC->new( -cipher => 'DES', -key => $key, ); my $ciphertext = $cipher->encrypt($plaintext); print("$ciphertext\n"); my $recovered = $cipher->decrypt($ciphertext); print("$recovered\n");
2006-10-12 Retitled by g0n, as per Monastery guidelines
Original title: 'Tk Error Mystery'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Strange Error from interaction of Tk and Crypt::CBC
by zentara (Cardinal) on Oct 11, 2006 at 17:36 UTC | |
by Anonymous Monk on Oct 11, 2006 at 18:11 UTC |