App-bmkpasswd

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    list

  - API change; export mkpasswd and passwdcmp by default

  - Add 'reset_seed' option to Crypt::Bcrypt::Easy's constructor as sugar for
    calling 'mkpasswd_forked' at object construction time

2.006001 2015-06-21

  - Add 'mkpasswd_forked' function for resetting salt generator seeds in child
    processes or threads.

2.005004 2015-03-11

  - 'use strictures 2;' for saner fatal warnings behavior

  - Faster tests

2.005003 2014-12-02

  - Kill constant time comparison completely; this was a silly addition that

README.mkdn  view on Meta::CPAN

        # ...
      } else {
        die "Don't know how to create a salt for type '$type'!"
      }
    };

Most people want random salts, in which case the default salt generator
should be fine.

See ["mkpasswd\_forked"](#mkpasswd_forked) if your application loads this module before forking
or creating threads that generate passwords.

## mkpasswd\_available

    my @available = mkpasswd_available;

    if ( mkpasswd_available('sha512') ) { ... }

Given no arguments, returns the list of available hash types.

Given a type (see ["mkpasswd"](#mkpasswd)), returns boolean true if the method is available. ('bcrypt' is
always available.)

## mkpasswd\_forked

    # After a fork / new thread is created:
    mkpasswd_forked;

To retain secure salts after forking the process or creating a new thread, 
it's advisable to either only load this module after creating the new process
or call **mkpasswd\_forked** in the new process to reset the random seeds used
by salt generators.

Added in `v2.6.1`.

# AUTHOR

Jon Portnoy <jon@portnoy.me>

lib/App/bmkpasswd.pm  view on Meta::CPAN

      # ...
    } else {
      die "Don't know how to create a salt for type '$type'!"
    }
  };

Most people want random salts, in which case the default salt generator
should be fine.

See L</mkpasswd_forked> if your application loads this module before forking
or creating threads that generate passwords.

=head2 mkpasswd_available

  my @available = mkpasswd_available;

  if ( mkpasswd_available('sha512') ) { ... }

Given no arguments, returns the list of available hash types.

Given a type (see L</mkpasswd>), returns boolean true if the method is available. ('bcrypt' is
always available.)

=head2 mkpasswd_forked

  # After a fork / new thread is created:
  mkpasswd_forked;

To retain secure salts after forking the process or creating a new thread, 
it's advisable to either only load this module after creating the new process
or call B<mkpasswd_forked> in the new process to reset the random seeds used
by salt generators.

Added in C<v2.6.1>.

=head1 AUTHOR

Jon Portnoy <jon@portnoy.me>

lib/Crypt/Bcrypt/Easy.pm  view on Meta::CPAN


Creates and returns a new Crypt::Bcrypt::Easy object.

The default C<cost> is '08'. This can be also be tuned for individual runs;
see L</crypt>.

(This is merely a convenience function for calling C<<
Crypt::Bcrypt::Easy->new >>.)

If your application generates passwords in multiple child processes or
threads, you can cause L<App::bmkpasswd/mkpasswd_forked> to be automatically
called during object construction in each individual process by specifying the
C<reset_seed> option:

  my $bcrypt = bcrypt( reset_seed => 1, cost => 8 );

(The C<reset_seed> option was added in C<v2.7.1>.)

=head3 crypt

Create and return a new password hash:



( run in 1.380 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )