Apache2-API

 view release on metacpan or  search on metacpan

lib/Apache2/API.pm  view on Meta::CPAN

        };
        if( $@ )
        {
            return( $self->error( "Error adding string to create MD5 hash: $@" ) );
        }
    }

    # 16 bytes
    my $final = $ctx->digest;

    # 5) 1000 iterations "rounds"
    for( my $i = 0; $i < 1000; $i++ )
    {
        my $t = Digest::MD5->new;

        eval
        {
            if( $i & 1 )
            {
                $t->add( $passwd );
            }

lib/Apache2/API/Password.pod  view on Meta::CPAN


If omitted, a random salt is generated using L<Crypt::URandom> or L<Bytes::Random::Secure> (one of which must be installed).

=item * an existing modular-crypt hash string

E.g. the right-hand side of a C<.htpasswd> line: C<$apr1$...>, C<$2y$...>,
C<$5$...>, or C<$6$...>. The salt (and rounds/cost where applicable) are parsed.

=back

Note that the Apache algorithm to generate md5 password is not the same as simply using L<Digest::MD5>. Apache algorithm uses a more enhanced approach with a thousand iterations.

This constructor returns the newly instantiated object upon succes, or, upon error, returns C<undef> in scalar context, or an empty list in list context.

=head1 METHODS

=head2 algo

    # or 'bcrypt', 'sha256', 'sha512'
    $ht->algo( 'md5' );
    my $which = $ht->algo;



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