sub chiffrer_string { my ($a_chiffrer,$cle) = @_; my $key = $cle; $key .= "\0" x (16 - length($key)); my $plain_text = $a_chiffrer; $plain_text .= "\0" x (32 - length($a_chiffrer)); my $cipher = Mcrypt->new( algorithm => 'rijndael-256', mode => 'ecb' ); $cipher->init($key, ' 'x32); my $encrypted = $cipher->encrypt($plain_text); print unpack('H*', $encrypted), $/; $cipher->end(); }