Result:
found more than 868 distributions - search limited to the first 2001 files matching your query ( run in 1.362 )


Crypt-Bear

 view release on metacpan or  search on metacpan

src/rsa/rsa_i15_privexp.c  view on Meta::CPAN

	 * is the GCD of e and r; it must be 1 (otherwise, the private
	 * key or public exponent is not valid). The (u0,v0) or (u1,v1)
	 * pairs are the solution we are looking for.
	 *
	 * Since either a or b is reduced by at least 1 bit at each
	 * iteration, 62 iterations are enough to reach the end
	 * condition.
	 *
	 * To maintain the invariants, we must compute the same operations
	 * on the u* and v* values that we do on a and b:
	 *  - When a is divided by 2, u0 and v0 must be divided by 2.

 view all matches for this distribution


Crypt-CBC

 view release on metacpan or  search on metacpan

lib/Crypt/CBC.pm  view on Meta::CPAN

    # 2. headerless mode - use algorithm 'none'
    # 3. randomiv header - use algorithm 'nosalt'
    my $pbkdf = $options->{pbkdf} || ($options->{literal_key}     ? 'none'
				      :$header_mode eq 'randomiv' ? 'randomiv'
				      :DEFAULT_PBKDF);
    # iterations
    my $iter = $options->{iter} || DEFAULT_ITER;
    $iter =~ /[\d_]+/ && $iter >= 1 or croak "-iterations argument must be greater than or equal to 1";
    $iter =~ /[\d_]+/ && $iter >= 1 or croak "-iterations argument must be greater than or equal to 1";

    # hasher
    my $hc = $options->{hasher};
    my $nodeprecate = $options->{nodeprecate};
    

lib/Crypt/CBC.pm  view on Meta::CPAN

	                : ();
    return Crypt::CBC::PBKDF->new($pbkdf => 
				  {
				      key_len    => $self->{keysize},
				      iv_len     => $self->{blocksize},
				      iterations => $iter,
				      @hash_args,
				  }
	);
}

 view all matches for this distribution


Crypt-Cryptoki

 view release on metacpan or  search on metacpan

include/cryptoki/pkcs11t.h  view on Meta::CPAN

 * parameters to the CKM_PKCS5_PBKD2 mechanism. */
typedef struct CK_PKCS5_PBKD2_PARAMS {
        CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE           saltSource;
        CK_VOID_PTR                                pSaltSourceData;
        CK_ULONG                                   ulSaltSourceDataLen;
        CK_ULONG                                   iterations;
        CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
        CK_VOID_PTR                                pPrfData;
        CK_ULONG                                   ulPrfDataLen;
        CK_UTF8CHAR_PTR                            pPassword;
        CK_ULONG_PTR                               ulPasswordLen;

 view all matches for this distribution


Crypt-DES

 view release on metacpan or  search on metacpan

test.pl  view on Meta::CPAN

print "$suc of $tt tests passed ($fp\%)\n";
if($fail > 0) {
    print "Not all tests successful.  Please attempt to rebuild the package\n";
} else {
    print "\nRunning speed tests...\n";
    print "\nnon-cached cipher speed test.  5000 encrypt iterations\n";
    my $t2 = new Benchmark;
    for(1..5000) {
	my $cipher = new Crypt::DES(pack("H*",'1c587f1c13924fef'));
	$cipher->encrypt(pack("H*",'305532286d6f295a'));
    }
    my $t3 = new Benchmark;
    my $td1 = timediff($t3,$t2);
    my $ts1 = timestr($td1);
    print "$ts1\nok 343\n";

    print "\nnon-cached cipher speed test.  5000 decrypt iterations\n";
    my $t4 = new Benchmark;
    for(1..5000) {
        my $cipher = new Crypt::DES(pack("H*",'1c587f1c13924fef'));
        $cipher->decrypt(pack("H*",'63fac0d034d9f793'));
    }
    my $t5 = new Benchmark;
    my $td2 = timediff($t5,$t4);
    my $ts2 = timestr($td2);
    print "$ts2\nok 344\n";

    print "\ncached cipher speed test.  10000 encrypt iterations\n";
    {
    my $t6 = new Benchmark;
    my $cipher = new Crypt::DES(pack("H*",'1c587f1c13924fef'));
    for(1..10000) {
        $cipher->encrypt(pack("H*",'305532286d6f295a'));

test.pl  view on Meta::CPAN

    my $td3 = timediff($t7,$t6);
    my $ts3 = timestr($td3);
    print "$ts3\nok 345\n";
    }

    print "\ncached cipher speed test.  10000 decrypt iterations\n";
    {
    my $t8 = new Benchmark;
    my $cipher = new Crypt::DES(pack("H*",'1c587f1c13924fef'));
    for(1..10000) {
        $cipher->decrypt(pack("H*",'63fac0d034d9f793'));

 view all matches for this distribution


Crypt-DES_PP

 view release on metacpan or  search on metacpan

test-xs  view on Meta::CPAN

print "$suc of $tt tests passed ($fp\%)\n";
if($fail > 0) {
    print "Not all tests successful.  Please attempt to rebuild the package\n";
} else {
    print "\nRunning speed tests...\n";
    print "\nnon-cached cipher speed test.  5000 encrypt iterations\n";
    my $t2 = new Benchmark;
    for(1..5000) {
	my $cipher = new Crypt::DES_PP(pack("H*",'1c587f1c13924fef'));
	$cipher->encrypt(pack("H*",'305532286d6f295a'));
    }
    my $t3 = new Benchmark;
    my $td1 = timediff($t3,$t2);
    my $ts1 = timestr($td1);
    print "$ts1\nok 343\n";

    print "\nnon-cached cipher speed test.  5000 decrypt iterations\n";
    my $t4 = new Benchmark;
    for(1..5000) {
        my $cipher = new Crypt::DES_PP(pack("H*",'1c587f1c13924fef'));
        $cipher->decrypt(pack("H*",'63fac0d034d9f793'));
    }
    my $t5 = new Benchmark;
    my $td2 = timediff($t5,$t4);
    my $ts2 = timestr($td2);
    print "$ts2\nok 344\n";

    print "\ncached cipher speed test.  10000 encrypt iterations\n";
    {
    my $t6 = new Benchmark;
    my $cipher = new Crypt::DES_PP(pack("H*",'1c587f1c13924fef'));
    for(1..10000) {
        $cipher->encrypt(pack("H*",'305532286d6f295a'));

test-xs  view on Meta::CPAN

    my $td3 = timediff($t7,$t6);
    my $ts3 = timestr($td3);
    print "$ts3\nok 345\n";
    }

    print "\ncached cipher speed test.  10000 decrypt iterations\n";
    {
    my $t8 = new Benchmark;
    my $cipher = new Crypt::DES_PP(pack("H*",'1c587f1c13924fef'));
    for(1..10000) {
        $cipher->decrypt(pack("H*",'63fac0d034d9f793'));

test-xs  view on Meta::CPAN

    my $td4 = timediff($t9,$t8);
    my $ts4 = timestr($td4);
    print "$ts4\nok 346\n";
    }

    print "\ncached cipher speed test.  10000 decrypt iterations\n";
    {
    my $t8 = new Benchmark;
    my $key = pack ("H*", '1c587f1c13924fef');
    my $ciphertext = pack("H*",'63fac0d034d9f793');
    my $cipher = new Crypt::DES_PP($key);

 view all matches for this distribution


Crypt-DSA

 view release on metacpan or  search on metacpan

lib/Crypt/DSA/Util.pm  view on Meta::CPAN

    my $p2index = -1;
    ++$p2index, $p2 *= 2
	while $p2 <= $n1;
    $p2 /= 2;

    # number of iterations:  5 for 260-bit numbers, go up to 25 for smaller
    my $last_witness = 5;
    $last_witness += (260 - $p2index) / 13 if $p2index < 260;

    for my $witness_count (1..$last_witness) {
	$witness *= 1024;

 view all matches for this distribution


Crypt-Eksblowfish

 view release on metacpan or  search on metacpan

lib/Crypt/Eksblowfish/Subkeyed.pm  view on Meta::CPAN


=item Crypt::Eksblowfish::Subkeyed->new_initial

The standard Blowfish key schedule is an iterative process, which uses
the cipher algorithm to progressively replace subkeys, thus mutating the
cipher for subsequent iterations of keying.  The Eksblowfish key schedule
works similarly, but with a lot more iterations.  In both cases, the
key setup algorithm begins with a standard set of subkeys, consisting
of the initial bits of the fractional part of pi.  This constructor
creates and returns a Blowfish block cipher object with that standard
initial set of subkeys.  This is probably useful only to designers of
novel key schedules.

 view all matches for this distribution


Crypt-HSM

 view release on metacpan or  search on metacpan

include/pkcs11t.h  view on Meta::CPAN

 */
typedef struct CK_PKCS5_PBKD2_PARAMS {
        CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE           saltSource;
        CK_VOID_PTR                                pSaltSourceData;
        CK_ULONG                                   ulSaltSourceDataLen;
        CK_ULONG                                   iterations;
        CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
        CK_VOID_PTR                                pPrfData;
        CK_ULONG                                   ulPrfDataLen;
        CK_UTF8CHAR_PTR                            pPassword;
        CK_ULONG_PTR                               ulPasswordLen;

include/pkcs11t.h  view on Meta::CPAN

 */
typedef struct CK_PKCS5_PBKD2_PARAMS2 {
        CK_PKCS5_PBKDF2_SALT_SOURCE_TYPE saltSource;
        CK_VOID_PTR pSaltSourceData;
        CK_ULONG ulSaltSourceDataLen;
        CK_ULONG iterations;
        CK_PKCS5_PBKD2_PSEUDO_RANDOM_FUNCTION_TYPE prf;
        CK_VOID_PTR pPrfData;
        CK_ULONG ulPrfDataLen;
        CK_UTF8CHAR_PTR pPassword;
        CK_ULONG ulPasswordLen;

 view all matches for this distribution


Crypt-Komihash

 view release on metacpan or  search on metacpan

lib/Crypt/komihash.h  view on Meta::CPAN


/**
 * @brief KOMIRAND 64-bit pseudo-random number generator.
 *
 * Simple, reliable, self-starting yet efficient PRNG, with 2^64 period.
 * 0.62 cycles/byte performance. Self-starts in 4 iterations, which is a
 * suggested "warming up" initialization before using its output.
 *
 * @param[in,out] Seed1 Seed value 1. Can be initialized to any value
 * (even 0). This is the usual "PRNG seed" value.
 * @param[in,out] Seed2 Seed value 2, a supporting variable. Best initialized

 view all matches for this distribution


Crypt-MatrixSSL

 view release on metacpan or  search on metacpan

matrixssl-1-8-6-open/examples/httpsClient.c  view on Meta::CPAN

	WSADATA				wsaData;
	SOCKET				fd;
	short				cipherSuite;
	unsigned char		*ip, *c, *requestBuf;
	unsigned char		buf[1024];
	int					iterations, requests, connectAgain, status;
	int					quit, rc, bytes, i, j, err;
	time_t				t0, t1;
#if REUSE
	int					anonStatus;
#endif

matrixssl-1-8-6-open/examples/httpsClient.c  view on Meta::CPAN

#endif /* WINCE */

	conn = NULL;
/*
	First (optional) argument is ip address to connect to (port is hardcoded)
	Second (optional) argument is number of iterations to perform
	Third (optional) argument is number of keepalive HTTP requests
	Fourth (optional) argument is cipher suite number to use (0 for any)
*/
	ip = HTTPS_IP;
	iterations = ITERATIONS;
	requests = REQUESTS;
	cipherSuite = 0x0000;
	if (argc > 1) {
		ip = argv[1];
		if (argc > 2) {
			iterations = atoi(argv[2]);
			socketAssert(iterations > 0);
			if (argc > 3) {
				requests = atoi(argv[3]);
				socketAssert(requests > 0);
				if (argc > 4) {
					cipherSuite = (short)atoi(argv[4]);

matrixssl-1-8-6-open/examples/httpsClient.c  view on Meta::CPAN

	requestBuf = malloc(sizeof(requestAgain));
	t0 = time(0);
/*
	Main ITERATIONS loop
*/
	while (!quit && (i < iterations)) {
/*
		sslConnect uses port and ip address to connect to SSL server.
		Generates a new session
*/
		if (connectAgain) {

matrixssl-1-8-6-open/examples/httpsClient.c  view on Meta::CPAN

		Send a closure alert for clean shutdown of remote SSL connection
		This is for good form, some implementations just close the socket
*/
		sslWriteClosureAlert(conn);
/*
		Session done.  Connect again if more iterations remaining
*/
		socketShutdown(conn->fd);
		sslFreeConnection(&conn);
		connectAgain = 1;
	}

 view all matches for this distribution


Crypt-OpenPGP

 view release on metacpan or  search on metacpan

lib/Crypt/OpenPGP/Words.pm  view on Meta::CPAN

Given an octet string I<$octet_str>, encodes that string into a list of
English words.

The encoding is performed by splitting the string into octets; the list
of octets is then iterated over. There are two lists of words, 256 words
each. Two-syllable words are used for encoding odd iterations through
the loop; three-syllable words for even iterations. The word list is
formed by treating each octet as an index into the appropriate word list
(two- or three-syllable), then adding the word at that index to the list.

Returns the list of words.

 view all matches for this distribution


Crypt-OpenSSL-FASTPBKDF2

 view release on metacpan or  search on metacpan

lib/Crypt/OpenSSL/FASTPBKDF2.pm  view on Meta::CPAN


=head1 SYNOPSIS

  use Crypt::OpenSSL::FASTPBKDF2 qw/fastpbkdf2_hmac_sha1 fastpbkdf2_hmac_sha256 fastpbkdf2_hmac_sha512/;

  # Initialize parameters for password, salt, number of iterations, and desired output length (in bytes)
  my ($password, $salt, $num_iterations, $output_len) = ('password', 'salt', 100, 32);

  # Initialize buffer array (optional argument)
  my @buffer;

  # Set hash results into scalar variables
  my $hash_sha1 = fastpbkdf2_hmac_sha1($password, $salt, $num_iterations, $output_len, @buffer);        #= 0x8595d7aea0e7c952a35af9a838cc6b393449307cfcc7bd340e7e32ee90115650
  my $hash_sha256 = fastpbkdf2_hmac_sha256($password, $salt, $num_iterations, $output_len, @buffer);    #= 0x07e6997180cf7f12904f04100d405d34888fdf62af6d506a0ecc23b196fe99d8
  my $hash_sha512 = fastpbkdf2_hmac_sha512($password, $salt, $num_iterations, $output_len, @buffer);    #= 0xfef7276b107040a0a713bcbec9fd3e191cc6153249e245a3e1a22087dbe61606

  # Print the contents of the buffer as HEX
  print unpack('H*', join('', @buffer)); # "8595d7aea0e7c952a35af9a838cc6b393449307cfcc7bd340e7e32ee9011565007e6997180cf7f12904f04100d405d34888fdf62af6d506a0ecc23b196fe99d8fef7276b107040a0a713bcbec9fd3e191cc6153249e245a3e1a22087dbe61606"

=head1 DESCRIPTION

lib/Crypt/OpenSSL/FASTPBKDF2.pm  view on Meta::CPAN


Crypt::OpenSSL::FASTPBKDF2 is a set of Perl bindings for fastpbkdf2.

=head1 Static Methods

=head2 fastpbkdf2_hmac_sha1 ($password, $salt, $iterations, $output_len, :@buffer)

Executes PBKDF2 via HMAC_SHA1 to hash C<$password> with C<$salt> repeatedly, C<$iterations> times, to derive and return a hash that is C<$output_len> bytes long.
If the optional C<@buffer> param is provided, the result will also be appended onto the array.

=head2 fastpbkdf2_hmac_sha256 ($password, $salt, $iterations, $output_len, :@buffer)

Same as C<fastpbkdf2_hmac_sha1> but instead uses HMAC_SHA256

=head2 fastpbkdf2_hmac_sha512 ($password, $salt, $iterations, $output_len, :@buffer)

Same as C<fastpbkdf2_hmac_sha1> but instead uses HMAC_SHA512

=head1 SEE ALSO

 view all matches for this distribution


Crypt-OpenSSL-PBKDF2

 view release on metacpan or  search on metacpan

PBKDF2.pm  view on Meta::CPAN


This function returns a derived key that is supposed to be cryptographically 
strong.
The binary output key will be generated from a textual password B<$pass> using
a salt block B<$salt> (usually binary data) of length B<$salt_len>; the 
algorithm perform the number of iterations specified by B<$iter> (usually > 
1000, better if > 4000). If the salt is empty (or undef) the salt length must 
be 0. The output is binary data with length (in bytes) specified by the 
B<$key_len> parameter.
The function will not ever attempt to auto-calculate the length of the salt 
because it is not assumed to be a NULL terminated value, so its length is 

 view all matches for this distribution


Crypt-PBE

 view release on metacpan or  search on metacpan

t/10-PBKDF1.t  view on Meta::CPAN

use_ok('Crypt::PBE::PBKDF1');

my @args = (
    password   => 'mypassword',
    algorithm  => 'sha1',
    iterations => 1000,
    salt       => 'mysalt',
);

my $pbkdf1 = new_ok( 'Crypt::PBE::PBKDF1' => \@args );

 view all matches for this distribution


Crypt-PBKDF2

 view release on metacpan or  search on metacpan

lib/Crypt/PBKDF2.pm  view on Meta::CPAN


  return Module::Runtime::use_module($class)->new( %$hash_args );
}


has iterations => (
  is => 'ro',
  isa => Int,
  default => 600000,
);

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

    croak "Couldn't construct hasher for ''$info->{algorithm}''$opts: $_";
  };

  my $checker = $self->clone(
    hasher => $hasher,
    iterations => $info->{iterations},
    output_len => length($info->{hash}),
  );

  my $check_hash = $checker->PBKDF2($info->{salt}, $password);

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

}


sub PBKDF2 {
  my ($self, $salt, $password) = @_;
  my $iterations = $self->iterations;
  my $hasher = $self->hasher;
  my $output_len = $self->output_len || $hasher->hash_len;

  my $hLen = $hasher->hash_len;
  my $l = int($output_len / $hLen);

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

  }

  my $output;

  for my $i (1 .. $l) {
    $output .= $self->_PBKDF2_F($hasher, $salt, $password, $iterations, $i);
  }

  if ($r) {
    $output .= substr( $self->_PBKDF2_F($hasher, $salt, $password, $iterations, $l + 1), 0, $r);
  }

  return $output;
}

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

  my $self = shift;
  return unpack "H*", $self->PBKDF2(@_);
}

sub _PBKDF2_F {
  my ($self, $hasher, $salt, $password, $iterations, $i) = @_;
  my $result = 
  my $hash = 
    $hasher->generate( $salt . pack("N", $i), $password );

  for my $iter (2 .. $iterations) {
    $hash = $hasher->generate( $hash, $password );
    $result ^= $hash;
  }

  return $result;

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

  }

  my $algo_string = $hasher->to_algo_string;
  $algo_string = defined($algo_string) ? "{$algo_string}" : "";

  return '$PBKDF2$' . "$hasher_class$algo_string:" . $self->iterations . ':'
  . MIME::Base64::encode($salt, "") . '$'
  . MIME::Base64::encode($hash, "");
}

sub _encode_string_ldaplike {

lib/Crypt/PBKDF2.pm  view on Meta::CPAN


  my $algo_string = $hasher->to_algo_string;
  $algo_string = defined($algo_string) ? "+$algo_string" : "";

  return '{X-PBKDF2}' . "$hasher_class$algo_string:" 
  . $self->_b64_encode_int32($self->iterations) . ':'
  . MIME::Base64::encode($salt, "") . ':'
  . MIME::Base64::encode($hash, "");
}


lib/Crypt/PBKDF2.pm  view on Meta::CPAN

  my ($self, $hashed) = @_;
  if ($hashed !~ /^\$PBKDF2\$/) {
    croak "Unrecognized hash";
  }

  if (my ($algorithm, $opts, $iterations, $salt, $hash) = $hashed =~
      /^\$PBKDF2\$([^:}]+)(?:\{([^}]+)\})?:(\d+):([^\$]+)\$(.*)/) {
    return {
      algorithm => $algorithm,
      algorithm_options => $opts,
      iterations => $iterations,
      salt => MIME::Base64::decode($salt),
      hash => MIME::Base64::decode($hash),
    }
  } else {
    croak "Invalid format";

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

  my ($self, $hashed) = @_;
  if ($hashed !~ /^\{X-PBKDF2}/i) {
    croak "Unrecognized hash";
  }

  if (my ($algo_str, $iterations, $salt, $hash) = $hashed =~
      /^\{X-PBKDF2}([^:]+):([^:]{6}):([^\$]+):(.*)/i) {
    my ($algorithm, $opts) = split /\+/, $algo_str;
    return {
      algorithm => $algorithm,
      algorithm_options => $opts,
      iterations => $self->_b64_decode_int32($iterations),
      salt => MIME::Base64::decode($salt),
      hash => MIME::Base64::decode($hash),
    }
  } else {
    croak "Invalid format";

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

  my %new_args = (
    $self->has_hash_class  ? (hash_class  => $self->hash_class) : (),
    $self->has_hash_args   ? (hash_args   => $self->hash_args)  : (),
    $self->has_output_len  ? (output_len  => $self->output_len) : (),
    $self->has_lazy_hasher ? () : (hasher => $self->hasher),
    iterations => $self->iterations,
    salt_len => $self->salt_len,
    %params,
  );
  
  return $class->new(%new_args);

lib/Crypt/PBKDF2.pm  view on Meta::CPAN


    use Crypt::PBKDF2;

    my $pbkdf2 = Crypt::PBKDF2->new(
        hash_class => 'HMACSHA2', # this is the default (HMAC-SHA256)
        iterations => 600000,     # so is this
        output_len => 32,         # and this
        salt_len => 4,            # and this.
    );

    my $hash = $pbkdf2->generate("s3kr1t_password");

lib/Crypt/PBKDF2.pm  view on Meta::CPAN


PBKDF2 is a secure password hashing algorithm that uses the techniques of
"key strengthening" to make the complexity of a brute-force attack
arbitrarily high. PBKDF2 uses any other cryptographic hash or cipher (by
convention, usually HMAC-SHA1, but C<Crypt::PBKDF2> is fully pluggable), and
allows for an arbitrary number of iterations of the hashing function, and a
nearly unlimited output hash size (up to 2**32 - 1 times the size of the
output of the backend hash). The hash is salted, as any password hash should
be, and the salt may also be of arbitrary size.

=head1 ATTRIBUTES

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

B<Type:> Object (must fulfill role L<Crypt::PBKDF2::Hash>), B<Default:> None.

It is also possible to provide a hash object directly; in this case the
C<hash_class> and C<hash_args> are ignored.

=head2 iterations

B<Type:> Integer, B<Default:> 600000.

The default number of iterations of the hashing function to use for the
C<generate> and C<PBKDF2> methods.

=head2 output_len

B<Type:> Integer.

lib/Crypt/PBKDF2.pm  view on Meta::CPAN

C<algorithm>: A string representing the hash algorithm used. See
L</hasher_from_algorithm ($algo_str)>.

=item *

C<iterations>: The number of iterations used.

=item *

C<salt>: The salt, in raw binary form.

 view all matches for this distribution


Crypt-PKCS11

 view release on metacpan or  search on metacpan

crypt_pkcs11.c  view on Meta::CPAN

    if (crypt_pkcs11_ck_key_derivation_string_data_set_pData(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_saltSource(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_saltSource(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_pSaltSourceData(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_pSaltSourceData(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_iterations(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_iterations(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_prf(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_prf(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_pPrfData(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_pPrfData(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_pPassword(0, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }

crypt_pkcs11.c  view on Meta::CPAN

    if (crypt_pkcs11_ck_key_derivation_string_data_set_pData(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_saltSource(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_saltSource(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_pSaltSourceData(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_pSaltSourceData(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_iterations(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_iterations(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_prf(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_prf(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_pPrfData(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_set_pPrfData(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }
    if (crypt_pkcs11_ck_pkcs5_pbkd2_params_get_pPassword(1, 0) != CKR_ARGUMENTS_BAD) { return __LINE__; }

 view all matches for this distribution


Crypt-PQClean-Sign

 view release on metacpan or  search on metacpan

pqclean/crypto_sign/falcon-1024/aarch64/codec.c  view on Meta::CPAN

        /*
         * Push as many zeros as necessary, then a one. Since the
         * absolute value is at most 2047, w can only range up to
         * 15 at this point, thus we will add at most 16 bits
         * here. With the 8 bits above and possibly up to 7 bits
         * from previous iterations, we may go up to 31 bits, which
         * will fit in the accumulator, which is an uint32_t.
         */
        acc <<= (w + 1);
        acc |= 1;
        acc_len += w + 1;

 view all matches for this distribution


Crypt-PWSafe3

 view release on metacpan or  search on metacpan

lib/Crypt/PWSafe3/Databaseformat.pm  view on Meta::CPAN

2.1 SALT is a 256 bit random value, generated at file creation time.

2.3 P' is the "stretched key" generated from the user's passphrase and
the SALT, as defined in by the hash-function-based key stretching
algorithm in [KEYSTRETCH] (Section 4.1), with SHA-256 [SHA256] as the
hash function, and ITER iterations (at least 2048, i.e., t = 11).

2.4 ITER is the number of iterations on the hash function to calculate P',
stored as a 32 bit little-endian value. This value is stored here in order
to future-proof the file format against increases in processing power.

2.5 H(P') is SHA-256(P'), and is used to verify that the user has the
correct passphrase.

 view all matches for this distribution


Crypt-Passphrase-PBKDF2

 view release on metacpan or  search on metacpan

lib/Crypt/Passphrase/PBKDF2.pm  view on Meta::CPAN

	my ($class, %args) = @_;
	my $type = $args{type} || 'sha256';
	croak "Hash type $type not supported" unless exists $param_for_type{$type};
	return bless {
		salt_size  => $args{salt_size} || 16,
		iterations => $args{iterations} || 100_000,
		type       => $type,
	}, $class;
}

sub ab64_encode {

lib/Crypt/Passphrase/PBKDF2.pm  view on Meta::CPAN

}

sub hash_password {
	my ($self, $password) = @_;
	my $salt = $self->random_bytes($self->{salt_size});
	my $hash = derive($param_for_type{ $self->{type} }, $password, $salt, $self->{iterations});
	return join '$', "\$pbkdf2-$self->{type}", $self->{iterations}, ab64_encode($salt), ab64_encode($hash);
}

my $decode_regex = qr/ \A \$ pbkdf2- (\w+) \$ (\d+) \$ ([^\$]+) \$ ([^\$]*) \z /x;

sub needs_rehash {
	my ($self, $hash) = @_;
	my ($type, $iterations, $salt64, $hash64) = $hash =~ $decode_regex or return 1;
	return 1 if $type ne $self->{type} or $iterations != $self->{iterations};
	return 1 if length ab64_decode($salt64) != $self->{salt_size};
	return;
}

sub crypt_subtypes {

lib/Crypt/Passphrase/PBKDF2.pm  view on Meta::CPAN

}

sub verify_password {
	my ($class, $password, $hash) = @_;

	my ($type, $iterations, $salt64, $hash64) = $hash =~ $decode_regex or return 0;
	return 0 unless exists $param_for_type{$type};
	return verify(ab64_decode($hash64), $param_for_type{$type}, $password, ab64_decode($salt64), $iterations);
}

1;

# ABSTRACT: A PBKDF2 encoder for Crypt::Passphrase

lib/Crypt/Passphrase/PBKDF2.pm  view on Meta::CPAN


 my $passphrase = Crypt::Passphrase->new(
   encoder => {
     module     => 'PBKDF2',
     type       => 'sha256',
     iterations => 128_000,
   },
 );

=head1 DESCRIPTION

This class implements a PBKDF2 encoder for Crypt::Passphrase. It allows for any SHA-1 or SHA-2 hash, and any number of iterations.

=head2 Configuration

It accepts the following arguments:

lib/Crypt/Passphrase/PBKDF2.pm  view on Meta::CPAN


=item * type

This can be any of C<sha1>, C<sha224>, C<sha256> (default), C<sha384> or C<sha512>.

=item * iterations

This will be the iteration count, defaulting to C<100000>.

=item * salt_size

 view all matches for this distribution


Crypt-PostgreSQL

 view release on metacpan or  search on metacpan

lib/Crypt/PostgreSQL.pm  view on Meta::CPAN

    if(!defined $salt){
        $salt = Crypt::URandom::urandom(16);
    }elsif(length($salt) != 16){
        croak 'The salt length must be 16!';
    }
    my $iterations = 4096;
    my $digest_key = pbkdf2($password, $salt, $iterations, 'SHA256', 32);
    my $client_key = hmac('SHA256', $digest_key ,'Client Key');
    my $b64_client_key = sha256_b64($client_key);
    my $b64_server_key = hmac_b64('SHA256', $digest_key, 'Server Key');
    my $b64_salt = encode_base64($salt, '');
    return "SCRAM-SHA-256\$$iterations:$b64_salt\$$b64_client_key:$b64_server_key";
}


=head1 SECURITY

 view all matches for this distribution


Crypt-Primes

 view release on metacpan or  search on metacpan

docs/1-Fast_Generation_Of_Primes-Ueli_Maurer.ps  view on Meta::CPAN

b(ma)o(y)f(b)q(e)i(to)q(o)e(small)i(to)e(con)o(tain)35
2285 y(an)i Fy(R)g FE(for)f(whic)o(h)i(2)p Fy(RF)f FE(+)8
b(1)13 b(is)i(prime.)20 b(An)14 b(endless)h(execution)g(of)f(the)g
Fl(WHILE)f FE(lo)q(op)h(can)g(b)q(e)h(prev)o(en)o(t-)35
2345 y(ed,)h(for)f(example)i(b)o(y)f(restricting)g(the)g(n)o(um)o(b)q
(er)g(of)f(iterations.)21 b(F)l(urthermore,)15 b(it)h(m)o(ust)f(b)q(e)i
(a)o(v)o(oided)35 2404 y(with)c(high)h(probabilit)o(y)f(that)f(the)h
(in)o(terv)m(al)g([)p Fy(I)830 2411 y FB(1)850 2404 y
Fy(;)8 b(I)891 2411 y FB(2)909 2404 y FE(])13 b(con)o(tains)f(no)h
(prime)g(factor)e(b)q(ecause)j(in)f(this)g(case)35 2463
y Fy(F)26 b FE(\(or)18 b(at)g(least)h(the)g(smallest)g(prime)h(factor)d

 view all matches for this distribution


Crypt-Pwsafe

 view release on metacpan or  search on metacpan

lib/Crypt/Pwsafe.pm  view on Meta::CPAN

		die "$file has < $len bytes.\n";
	}
	$header =~ /^PWS3/ or warn "$file is not a version 3 Password Safe data file.\n";
	my $salt = substr($header, 4, 32);
	my $n_iters = unpack('V', substr($header, 36, 4));
	warn "$file uses < 2048 iterations of hash.\n" if $n_iters < 2048;
	warn "$file uses $n_iters iterations of hash?\n" if $n_iters > 20480;
	my $fhash = substr($header, 40, 32);
	my $ptag = _stretch_key($salt, $n_iters, $fhash, $pw);
	die "Bad safe combination.\n" unless $ptag;
	my $crypt = "";
	# Assume that the whole PWsafe file can comfortably fit into the memory

 view all matches for this distribution


Crypt-RHash

 view release on metacpan or  search on metacpan

librhash/snefru.c  view on Meta::CPAN

 * of the Khufu and Khafre block ciphers.
 *
 * The original design of Snefru was shown to be insecure by Eli Biham and
 * Adi Shamir who were able to use differential cryptanalysis to find hash
 * collisions. The design was then modified by increasing the number of
 * iterations of the main pass of the algorithm from two to eight. Although
 * differential cryptanalysis can break the revised version with less
 * complexity than brute force search (a certificational weakness), the attack
 * requires 2^88.5 operations and is thus not currently feasible in practice.
 *
 * The algorithm can also be run with a variable number of "rounds" of the

 view all matches for this distribution


Crypt-RNCryptor

 view release on metacpan or  search on metacpan

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN

    PBKDF2_OUTPUT_SIZE => 32,
};

use Class::Accessor::Lite (
    ro => [qw(
        password pbkdf2_iterations
        encryption_key hmac_key
    )],
);

sub new {
    my ($class, %opts) = @_;
    if ($opts{password} && ($opts{encryption_key} || $opts{hmac_key})) {
        confess 'Cannot set the "password" option with "encryption_key" or "hmac_key" option.';
    }
    if ($opts{pbkdf2_iterations}) {
        confess 'v3.1 is not supported still yet.';
    }
    bless {
        password => $opts{password},
        encryption_key => $opts{encryption_key},
        hmac_key => $opts{hmac_key},
        pbkdf2_iterations => DEFAULT_PBKDF2_ITERATIONS,
    }, $class;
}

sub pbkdf2 {
    my ($self, $password, $salt, $iterations) = @_;
    $iterations ||= $self->pbkdf2_iterations;
    Crypt::PBKDF2->new(
        hash_class => 'HMACSHA1',
        iterations => $iterations,
        output_len => PBKDF2_OUTPUT_SIZE,
    )->PBKDF2($salt, $password);
}

sub aes256cbc {

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN

        -cipher => 'Crypt::OpenSSL::AES',
    );
}

sub make_options {
    my ($self, $use_password, $pbkdf2_iterations) = @_;
    confess 'TODO';
}

sub encrypt {
    my $self = shift;

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN

    my ($self, $plaintext, %opts) = @_;
    my $iv = $opts{iv} || Crypt::CBC->random_bytes(IV_SIZE);
    my $encryption_salt = $opts{encryption_salt} || Crypt::CBC->random_bytes(ENCRYPTION_SALT_SIZE);
    my $hmac_salt = $opts{hmac_salt} || Crypt::CBC->random_bytes(HMAC_SALT_SIZE);
    my $password = $opts{password} || $self->password;
    my $pbkdf2_iterations = $opts{pbkdf2_iterations} || $self->pbkdf2_iterations;

    my $encryption_key = $self->pbkdf2($password, $encryption_salt);
    my $hmac_key = $self->pbkdf2($password, $hmac_salt);

    # Header = 3 || 1 || EncryptionSalt || HMACSalt || IV

lib/Crypt/RNCryptor/V3.pm  view on Meta::CPAN


Create a cryptor instance.

    %opts = (
        password => 'any length password',
        pbkdf2_iterations => DEFAULT_PBKDF2_ITERATIONS,
        # or
        encryption_key => '32 length key',
        hmac_key => '32 length key',
    );

 view all matches for this distribution


Crypt-Rhash

 view release on metacpan or  search on metacpan

librhash/snefru.c  view on Meta::CPAN

 * of the Khufu and Khafre block ciphers.
 *
 * The original design of Snefru was shown to be insecure by Eli Biham and
 * Adi Shamir who were able to use differential cryptanalysis to find hash
 * collisions. The design was then modified by increasing the number of
 * iterations of the main pass of the algorithm from two to eight. Although
 * differential cryptanalysis can break the revised version with less
 * complexity than brute force search (a certificational weakness), the attack
 * requires 2^88.5 operations and is thus not currently feasible in practice.
 *
 * The algorithm can also be run with a variable number of "rounds" of the

 view all matches for this distribution


Crypt-SecretBuffer

 view release on metacpan or  search on metacpan

secret_buffer_parse_match_str.c  view on Meta::CPAN

               (int)(ret_pos? ret_pos-orig : -1), (int)(ret_lim? ret_lim-orig : -1), (int)anchor_fail);
         }
#endif
         #undef SB_HANDLE_ENCODING_ERROR
         /* Code below does not set return values unless `search_pos >= real_search_pos`
          * so that the consttime busywork iterations don't change any return-value state.
          */
         /* Found the goal? (match, or negated match) */
         if (matched != negate) {
            /* The desired (multi?)match begins here, unless it already began */
            if (!ret_pos && search_pos >= real_search_pos) {

secret_buffer_parse_match_str.c  view on Meta::CPAN

               (int)(ret_pos? ret_pos-orig : -1), (int)(ret_lim? ret_lim-orig : -1), (int)anchor_fail);
         }
#endif
         #undef SB_HANDLE_ENCODING_ERROR
         /* Code below does not set return values unless `search_pos >= real_search_pos`
          * so that the consttime busywork iterations don't change any return-value state.
          */
         /* Found the goal? (match, or negated match) */
         if (matched != negate) {
            /* The desired (multi?)match begins here, unless it already began */
            if (!ret_lim && search_lim <= real_search_lim) {

 view all matches for this distribution


Crypt-Serpent

 view release on metacpan or  search on metacpan

Serpent.pm  view on Meta::CPAN

"Serpent is a 128-bit block cipher, meaning that data is encrypted and
decrypted in 128-bit chunks. The key length can vary, but for the purposes
of the AES it is defined to be either 128, 192, or 256 bits. This block size
and variable key length is standard among all AES candidates and was one of
the major design requirements specified by NIST. The Serpent algorithm uses
32 rounds, or iterations of the main algorithm."

=over 4

=cut

 view all matches for this distribution


Crypt-Sodium-XS

 view release on metacpan or  search on metacpan

lib/Crypt/Sodium/XS/MemVault.pm  view on Meta::CPAN

=head2 compare

B<!!WARNING!!>: The results of this comparison method can be used to leak
information about the protected memory. If one can make arbitrary comparisons
and has any visibility to the result, the protected data can be determined in
(nbits - trailing_zero_bits) iterations! For a 256-bit key, that means it takes
no more than 256 tries to extract the key. This method is fixed-time, but the
only safe use of the result is whether it equals 0 or not, and L</memcmp> is a
better way to determine equality.

  $mv->compare($bytes, $size);

 view all matches for this distribution


Crypt-UnixCrypt_XS

 view release on metacpan or  search on metacpan

lib/Crypt/UnixCrypt_XS.pm  view on Meta::CPAN


This is the conventional F<crypt> interface.  I<PASSWORD> and I<SALT> are both strings.  The password will be hashed, in a manner determined by the salt, and a string is returned containing the salt and hash.  The salt is at the beginning of the retu...

If the salt is an empty string, then the password is ignored and an empty string is returned.  The empty salt/hash string is thus used to not require a password.

If the salt string starts with two base 64 digits (from the set [./0-9A-Za-z]), then the password is hashed using the traditional DES-based algorithm.  The salt is used to modify the DES algorithm in one of 4096 different ways.  The first eight chara...

If the salt string starts with an underscore character and then eight base 64 digits then the password is hashed using the extended DES-based algorithm from BSDi.  The first four base 64 digits specify how many encryption rounds are to be performed. ...

=item crypt_rounds( PASSWORD, NROUNDS, SALTNUM, BLOCK )

This is the core of the DES-based F<crypt> algorithm, exposed here to allow variant hash functions to be built.  I<PASSWORD> is a string; its first eight characters are used as a DES key.  I<SALTNUM> is an integer; its low 24 bits are used to modify ...

=item fold_password( PASSWORD )

This is the pre-hashing algorithm used in the extended DES algorithm to fold a long password to the size of a DES key.  It takes a password of any length, and returns a password of eight characters which is completely equivalent in the extended DES a...

 view all matches for this distribution


Crypt-xxHash

 view release on metacpan or  search on metacpan

ext/xxHash/README.md  view on Meta::CPAN


#### Makefile variables
When compiling the Command Line Interface `xxhsum` using `make`, the following environment variables can also be set :
- `DISPATCH=1` : use `xxh_x86dispatch.c`, select at runtime between `scalar`, `sse2`, `avx2` or `avx512` instruction set. This option is only valid for `x86`/`x64` systems. It is enabled by default when target `x86`/`x64` is detected. It can be force...
- `LIBXXH_DISPATCH=1` : same idea, implemented a runtime vector extension detector, but within `libxxhash`. This parameter is disabled by default. When enabled (only valid for `x86`/`x64` systems), new symbols published in `xxh_x86dispatch.h` become ...
- `XXH_1ST_SPEED_TARGET` : select an initial speed target, expressed in MB/s, for the first speed test in benchmark mode. Benchmark will adjust the target at subsequent iterations, but the first test is made "blindly" by targeting this speed. Current...
- `NODE_JS=1` : When compiling `xxhsum` for Node.js with Emscripten, this links the `NODERAWFS` library for unrestricted filesystem access and patches `isatty` to make the command line utility correctly detect the terminal. This does make the binary ...

### Building xxHash - Using vcpkg

You can download and install xxHash using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:

 view all matches for this distribution


( run in 1.362 second using v1.01-cache-2.11-cpan-96521ef73a4 )