sub new_cipher { my $newkey = get_key() if ($key eq ""); my $cipher = Crypt::CBC->new( {'key' => "$newkey", 'cipher' => 'DES', 'iv' => '$KJh#(}q', 'regenerate_key' => 0, # default true 'padding' => 'space', 'prepend_iv' => 0 }); return $cipher; } sub get_key { my $getkeybox = $mw->DialogBox(-title=>"Set Encryption Key", -buttons=>["Ok", "Cancel"] ); $getkeybox->add('Label', -anchor => 'w', -justify => 'left', -text => qq(Please enter your Encryption Key))->pack(qw/-side top -anchor w/); my $keybox = $getkeybox->add('Entry', -takefocus => '1', -textvariable => "$key", )->pack(qw/-side top -fill both -expand 1 -anchor w/); my $button = $getkeybox->Show(); my $newkey = pack("H16", $keybox->get) unless $button eq "Cancel"; $key = $newkey; return $newkey; }