Thread Crypt::Rijndael und die blocksize
(4 answers)
Opened by styx-cc at 2007-11-25 04:11
Vielen Dank, habs jetzt mit Crypt-CBC gemacht, klappt wunderbar:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/usr/bin/perl use strict; use warnings; use Crypt::CBC; use Digest::MD5 qw/md5_hex/; my $password = $ARGV[0] || 1; my $cipher = Crypt::CBC->new(-key => md5_hex($password), -cipher => 'Rijndael'); print decrypt( encrypt('gfg') ); sub encrypt { my $plain = shift; #$plain must be a multiple of 16 (in bytes) my $crypted = $cipher->encrypt($plain); return $crypted; } sub decrypt { my $crypted = shift; my $plain = $cipher->decrypt($crypted); return $plain; } Pörl.
|