File-KDBX-XS

 view release on metacpan or  search on metacpan

eg/benchmark.pl  view on Meta::CPAN

use warnings;
use strict;

use Crypt::Rijndael;
use Crypt::Cipher;
use File::KDBX::XS;

use Benchmark qw(:all :hireswallclock);
use Test::More;

my $iterations  = shift // 50;

my $rounds      = 500_000;
my $key         = "\1" x 32;
my $seed        = "\1" x 16;
my $expected    = pack('H*', '3f7dfb512060cc8be094cd259c7ff03c');

sub xs {
    my $result = File::KDBX::KDF::AES::_transform_half_xs($key, $seed, $rounds);
    return $result;
}

eg/benchmark.pl  view on Meta::CPAN

    return $result;
}

my $r = xs();
is $r, $expected, 'AES KDF transform works' or diag explain unpack('H*', $r);
is $r, cryptx(), 'XS transform agrees with CryptX';
is $r, crypt_rijndael(), 'XS transform agrees with Crypt::Rijndael';

done_testing;

my $timings = timethese($iterations, {
    crypt_rijndael  => \&crypt_rijndael,
    cryptx          => \&cryptx,
    xs              => \&xs,
});
cmpthese($timings);

libtomcrypt/src/headers/tomcrypt_custom.h  view on Meta::CPAN

      /* Maximum recursion limit when processing nested ASN.1 types. */
      #define LTC_DER_MAX_RECURSION 30
   #endif
#endif

#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_SSH)
   /* Include the MPI functionality?  (required by the PK algorithms) */
   #define LTC_MPI

   #ifndef LTC_PK_MAX_RETRIES
      /* iterations limit for retry-loops */
      #define LTC_PK_MAX_RETRIES  20
   #endif
#endif

#ifdef LTC_MRSA
   #define LTC_PKCS_1
#endif

#if defined(LTC_MRSA) || defined(LTC_MECC)
   #define LTC_PKCS_8

libtomcrypt/src/headers/tomcrypt_private.h  view on Meta::CPAN

} pbes_properties;

typedef struct
{
   pbes_properties type;
   const void *pwd;
   unsigned long pwdlen;
   ltc_asn1_list *enc_data;
   ltc_asn1_list *salt;
   ltc_asn1_list *iv;
   unsigned long iterations;
   /* only used for RC2 */
   unsigned long key_bits;
} pbes_arg;

/*
 * Internal functions
 */


/* tomcrypt_cipher.h */

libtomcrypt/src/headers/tomcrypt_private.h  view on Meta::CPAN



#ifdef LTC_PKCS_12

int pkcs12_utf8_to_utf16(const unsigned char *in,  unsigned long  inlen,
                               unsigned char *out, unsigned long *outlen);

int pkcs12_kdf(               int   hash_id,
               const unsigned char *pw,         unsigned long pwlen,
               const unsigned char *salt,       unsigned long saltlen,
                     unsigned int   iterations, unsigned char purpose,
                     unsigned char *out,        unsigned long outlen);

#endif  /* LTC_PKCS_12 */

/* tomcrypt_prng.h */

#define LTC_PRNG_EXPORT(which) \
int which ## _export(unsigned char *out, unsigned long *outlen, prng_state *prng)      \
{                                                                                      \
   unsigned long len = which ## _desc.export_size;                                     \



( run in 0.968 second using v1.01-cache-2.11-cpan-71847e10f99 )