The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl -w

use lib 't';
use Testdata;

use Test::More tests => @ciphers + 1;

BEGIN { use_ok (Crypt::ECB) }

my $ecb = Crypt::ECB->new;

foreach my $cipher (@ciphers)
{
	eval { $ecb->cipher($cipher) };
	SKIP: { skip "$cipher not installed", 1 if ($@ || $cipher eq 'NULL');

		my $ks = $ecb->keysize || 56;

		$ecb->key( substr($key, 0, $ks) );
		my $enc = $ecb->encrypt_hex($plaintext);

		$ecb->key( substr(reverse($key), 0, $ks) );
		my $dec = $ecb->decrypt_hex($enc);

		ok($dec ne $plaintext, "key change recognized ($cipher)");
	}
}