Skip to content

Commit 97908cc

Browse files
authored
Merge pull request #12 from timlegge/updates
Update version and add a test for PR#7
2 parents 393fff6 + 81a8f77 commit 97908cc

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

lib/Crypt/CBC.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use Crypt::CBC::PBKDF;
66
use bytes;
77
use vars qw($VERSION);
88
no warnings 'uninitialized';
9-
$VERSION = '3.04';
9+
$VERSION = '3.05';
1010

1111
use constant RANDOM_DEVICE => '/dev/urandom';
1212
use constant DEFAULT_PBKDF => 'opensslv1';

t/github-issue7.t

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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();

0 commit comments

Comments
 (0)