The error shows up inuse Modern::Perl; use Crypt::CBC; my $cipher1 = Crypt::CBC->new( -key => 'my secret key', -cipher => 'Crypt::DES', -header => 'randomiv', ); my $plaintext = 'In nova fert animus mutatas dicere formas corpora; di, coeptis (nam v +os mutastis et illas) adspirate meis primaque ab origine mundi ad mea + perpetuum deducite tempora carmen!'; my $ciphertext = $cipher1->encrypt_hex($plaintext); say $ciphertext; my $cipher2 = Crypt::CBC->new( -key => 'my secret key', -cipher => 'Crypt::DES', #-header => 'randomiv', ); $plaintext = $cipher2->decrypt_hex($ciphertext); say $plaintext;
$plaintext = $cipher2->decrypt_hex($ciphertext);
The error goes away when commenting out -header => 'randomiv', in $cipher1 or uncommenting -header => 'randomiv', in $cipher2.
So it appears your ciphertext has been generated in a different way than the decription routine expects.
The docs for this module say:
The "salt" header is now the default as of Crypt::CBC version 2.17. In all earlier versions "randomiv" was the default.
It may very well be that your upgrading of the OS also caused an upgrade in the Crypt::CBC module which now uses a different default ('salt' instead of 'randomiv'). I used the latest version which is 2.33.
What version did you use before the upgrade and what version are you using now?
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
My blog: Imperial DeltronicsIn reply to Re: Salt issue
by CountZero
in thread Salt issue
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |