DBIx-Class-EncodedColumn-Crypt-PBKDF2

 view release on metacpan or  search on metacpan

lib/DBIx/Class/EncodedColumn/Crypt/PBKDF2.pm  view on Meta::CPAN

	};
} ## end sub make_check_sub

sub _get_pbkdf2_obj_from_args {
    my ( $args ) = @_;

	my %new_args = %$args;
# 	my %new_args;  ## We should probably do some validation of individual args
# 	$new_args{hash_class}   = $args->{hash_class}   if exists $args->{hash_class}; ## 'HMACSHA1', 'HMACSHA3'
# 	$new_args{hash_args}    = $args->{hash_args}    if exists $args->{hash_args};  ##  { sha_size => 512 }
# 	$new_args{iterations}   = $args->{iterations}   if exists $args->{iterations}; ## 1000
# 	$new_args{output_len}   = $args->{output_len}   if exists $args->{output_len}; ## 20
# 	$new_args{salt_len}     = $args->{salt_len}     if exists $args->{salt_len};   ## 4
# 	$new_args{encoding}     = $args->{encoding}     if exists $args->{encoding};   ## 'ldap'
# 	$new_args{length_limit} = $args->{length_limit} if exists $args->{length_limit};

	my $pbkdf2 = Crypt::PBKDF2->new(%new_args); 
	croak sprintf( "failed to create pbkdf2: %s\n", $_ ) unless $pbkdf2;

	return $pbkdf2;
}

lib/DBIx/Class/EncodedColumn/Crypt/PBKDF2.pm  view on Meta::CPAN


=head1 SYNOPSIS

  __PACKAGE__->add_columns(
      'password' => {
          data_type           => 'text',
          encode_column       => 1,
          encode_class        => 'Crypt::PBKDF2',
          encode_args         => {
              hash_class => 'HMACSHA1',
              iterations => 1000
          },
          encode_check_method => 'check_password',
      }
  )

=head1 DESCRIPTION

=head1 NAME

DBIx::Class::EncodedColumn::Crypt::PBKDF2 - PBKDF2 support for DBIx::Class::EncodedColumn

lib/DBIx/Class/EncodedColumn/Crypt/PBKDF2.pm  view on Meta::CPAN


Arguments to be passed to the C<hash_class> constructor.

=head2 hasher

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:> 1000.

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.

The default size (in bytes, not bits) of the output hash. If a value isn't
provided, the output size depends on the C<hash_class>S< / >C<hasher>
selected, and will equal the output size of the backend hash (e.g. 20 bytes
for HMACSHA1).

t/lib/Schema/PBKDF2.pm  view on Meta::CPAN

    },
    hash_custom => {
        data_type => 'text',
        is_nullable => 1,
        size => 254,
        encode_column => 1,
        encode_class => 'Crypt::PBKDF2',
        encode_args  => {
            hash_class  => 'HMACSHA3',
            hash_args   => { sha_size => 512 },
            iterations  => 2000,
        },
        encode_check_method => 'hash_custom_check'
    },
);
__PACKAGE__->set_primary_key('id');
 
1;



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