File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use Crypt::CBC::PBKDF;
66use bytes;
77use vars qw( $VERSION) ;
88no warnings ' uninitialized' ;
9- $VERSION = ' 3.04 ' ;
9+ $VERSION = ' 3.05 ' ;
1010
1111use constant RANDOM_DEVICE => ' /dev/urandom' ;
1212use constant DEFAULT_PBKDF => ' opensslv1' ;
Original file line number Diff line number Diff line change 1+ use strict;
2+ use warnings;
3+ use Test::More;
4+ use Crypt::CBC;
5+
6+ eval " use Crypt::Blowfish()" ;
7+ if ($@ ) {
8+ print " 1..0 # Skipped: Crypt::Blowfish not installed\n " ;
9+ exit ;
10+ }
11+
12+ # small script for Blowfish encryption and decryption
13+
14+ # The key for the blowfish encoding/decoding below
15+ my $privateString = ' 123456789012345678901234567890123456789012' ;
16+
17+ my $teststring = " Testtext" ;
18+
19+ my $key = pack (' H*' , $privateString );
20+
21+ my $params = {
22+ ' key' => $key ,
23+ ' cipher' => ' Blowfish' ,
24+ ' header' => ' randomiv' ,
25+ ' nodeprecate' => 1
26+ };
27+
28+ my $cipher = Crypt::CBC-> new($params );
29+ my $encoded = $cipher -> encrypt_hex($teststring );
30+
31+ my $decoded = $cipher -> decrypt_hex($encoded );
32+
33+ ok($teststring eq $decoded , " Properly decoded Blowfish with header => randomiv" );
34+
35+ done_testing();
You can’t perform that action at this time.
0 commit comments