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


Convert-CEGH

 view release on metacpan or  search on metacpan

examples/transliterate.pl  view on Meta::CPAN


./transliterate.pl

=head1 DESCRIPTION

This is a simple demonstration script that presents transliterations,
and retransliterations between Coptic, Ethiopic, Greek and Hebrew.


=head1 AUTHOR

Daniel Yacob,  L<dyacob@cpan.org|mailto:dyacob@cpan.org>

 view all matches for this distribution


Convert-TBX-Basic

 view release on metacpan or  search on metacpan

i-term.tbx  view on Meta::CPAN

        <langSet xml:lang="en" id="cid431">
          <descrip type="definition">way of spelling or writing lexemes that conforms to a conventionalized use</descrip>
          <admin type="source">ISO 24613 : 2006</admin>
          <descrip type="definition">Alt.def: </descrip>
          <admin type="source"/>
          <note>NOTE: Aside from standardized spellings of alphabetical languages, such as standard UK or US English, or reformed German spelling, there can be variations such as transliterations of languages in non-native scripts, stenographic rende...
          <note/>
          <note/>
          <transacGrp>
            <transac type="transactionType">origination</transac>
            <transacNote type="responsibility">Lindsay Martin (lindsay)</transacNote>

 view all matches for this distribution


Convert-UUlib

 view release on metacpan or  search on metacpan

uulib/crc32.c  view on Meta::CPAN

   *                       and crc(B') based on crc(B)
   * - since B' starts with many zeros, the crc of those initial zeros is still zero
   * - that means crc(B') = crc(B)
   * - unfortunately the trailing zeros of A' change the crc, so usually crc(A') != crc(A)
   * - the following code is a fast algorithm to compute crc(A')
   * - starting with crc(A) and appending length(B) zeros, needing just log2(length(B)) iterations
   * - the details are explained by the original author at
   *   https://stackoverflow.com/questions/23122312/crc-calculation-of-a-mostly-static-data-stream/23126768
   *
   * notes:
   * - I squeezed everything into one function to keep global namespace clean (original code two helper functions)

 view all matches for this distribution


Courriel

 view release on metacpan or  search on metacpan

perltidyrc  view on Meta::CPAN

-npro
-nsfs
--blank-lines-before-packages=0
--opening-hash-brace-right
--no-outdent-long-comments
--iterations=2
-wbb="% + - * / x != == >= <= =~ !~ < > | & >= < = **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="

 view all matches for this distribution


Cpanel-JSON-XS

 view release on metacpan or  search on metacpan

XS.xs  view on Meta::CPAN

                  else
                    has_utf8 = HeKUTF8(he);
                }
            }

          /* Undefined behaviour when the two iterations do not result in the same count.
             With threads::shared or broken tie. The last HEs might be NULL then or we'll
             miss some. */
          if (i != count)
            croak ("Unstable %shash key counts %d vs %d in subsequent runs",
                   is_tied ? "tied " : "", (int)count, (int)i);

 view all matches for this distribution


Cron-Toolkit

 view release on metacpan or  search on metacpan

lib/Cron/Toolkit.pm  view on Meta::CPAN

   }

   # the brute force approach for DMY is correct here because:
   # 1) the design is simple and easy to understand and debug
   # 2) solves all tricky end-of-month and leap year calculations
   # 3) 365 iterations per one-year time window is good enough

   my $max_tm = Time::Moment->new( year => 2099, month => 12, day => 31,
                                   hour => 23, minute => 59, second => 59 );
   my $max_iter = $tm->delta_days($max_tm) || 1;

 view all matches for this distribution


Crypt-Argon2

 view release on metacpan or  search on metacpan

include/argon2.h  view on Meta::CPAN

 */
ARGON2_PUBLIC int argon2_ctx(argon2_context *context, argon2_type type);

/**
 * Hashes a password with Argon2i, producing an encoded hash
 * @param t_cost Number of iterations
 * @param m_cost Sets memory usage to m_cost kibibytes
 * @param parallelism Number of threads and compute lanes
 * @param pwd Pointer to password
 * @param pwdlen Password size in bytes
 * @param salt Pointer to salt

include/argon2.h  view on Meta::CPAN

                                       const size_t hashlen, char *encoded,
                                       const size_t encodedlen);

/**
 * Hashes a password with Argon2i, producing a raw hash at @hash
 * @param t_cost Number of iterations
 * @param m_cost Sets memory usage to m_cost kibibytes
 * @param parallelism Number of threads and compute lanes
 * @param pwd Pointer to password
 * @param pwdlen Password size in bytes
 * @param salt Pointer to salt

include/argon2.h  view on Meta::CPAN

 */
ARGON2_PUBLIC const char *argon2_error_message(int error_code);

/**
 * Returns the encoded hash length for the given input parameters
 * @param t_cost  Number of iterations
 * @param m_cost  Memory usage in kibibytes
 * @param parallelism  Number of threads; used to compute lanes
 * @param saltlen  Salt size in bytes
 * @param hashlen  Hash size in bytes
 * @param type The argon2_type that we want the encoded length for

 view all matches for this distribution


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 = Benchmark->new();
    for(1..5000) {
	my $cipher = Crypt::DES->new(pack("H*",'1c587f1c13924fef'));
	$cipher->encrypt(pack("H*",'305532286d6f295a'));
    }
    my $t3 = Benchmark->new();
    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 = Benchmark->new();
    for(1..5000) {
        my $cipher = Crypt::DES->new(pack("H*",'1c587f1c13924fef'));
        $cipher->decrypt(pack("H*",'63fac0d034d9f793'));
    }
    my $t5 = Benchmark->new();
    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 = Benchmark->new();
    my $cipher = Crypt::DES->new(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 = Benchmark->new();
    my $cipher = Crypt::DES->new(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) {
	# Fresh, independent CSPRNG witness every round.  The old code

 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-OpenSSL-PKCS12

 view release on metacpan or  search on metacpan

scripts/generate-zero-length-attr-fixture.pl  view on Meta::CPAN

    }
    AuthSafeContents ::= SEQUENCE OF ContentInfo
    MacData ::= SEQUENCE {
        mac        DigestInfo,
        macSalt    OCTET STRING,
        iterations INTEGER OPTIONAL
    }
    DigestInfo ::= SEQUENCE {
        digestAlgorithm AlgorithmIdentifier,
        digest          OCTET STRING
    }

scripts/generate-zero-length-attr-fixture.pl  view on Meta::CPAN

        mac => {
            digestAlgorithm => { algorithm => $OID_SHA256 },
            digest          => "\x00" x 32,   # 32 dummy bytes (SHA-256 size)
        },
        macSalt    => "\x00" x 8,
        iterations => 2048,
    },
}) or die $pfx_asn->error;

# ── Write output ─────────────────────────────────────────────────────────────
my $out_file = 'certs/zero-length-attrs.p12';

 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


( run in 2.151 seconds using v1.01-cache-2.11-cpan-f03e8824b8d )