]>
Dogcows Code - chaz/p5-File-KDBX-XS/blob - eg/benchmark.pl
10 use Benchmark
qw(:all :hireswallclock);
13 my $iterations = shift // 50;
18 my $expected = pack('H*', '3f7dfb512060cc8be094cd259c7ff03c');
21 my $result = File
::KDBX
::KDF
::AES
::_transform_half_xs
($key, $seed, $rounds);
26 my $cipher = Crypt
::Cipher-
>new('AES', $key);
28 for (my $i = 0; $i < $rounds; ++$i) {
29 $result = $cipher->encrypt($result);
35 my $cipher = Crypt
::Rijndael-
>new($key, Crypt
::Rijndael
::MODE_ECB
());
37 for (my $i = 0; $i < $rounds; ++$i) {
38 $result = $cipher->encrypt($result);
44 is $r, $expected, 'AES KDF transform works' or diag explain
unpack('H*', $r);
45 is $r, cryptx
(), 'XS transform agrees with CryptX';
46 is $r, crypt_rijndael
(), 'XS transform agrees with Crypt::Rijndael';
50 my $timings = timethese
($iterations, {
51 crypt_rijndael
=> \
&crypt_rijndael
,
This page took 0.036129 seconds and 4 git commands to generate.