NAME

DBIx::Class::EncodedColumn::Digest

SYNOPSYS

#SHA-1 / hex encoding / generate check method
__PACKAGE__->add_columns(
  'password' => {
    data_type   => 'CHAR',
    size        => 40,
    encode_column => 1,
    encode_class  => 'Digest',
    encode_args   => {algorithm => 'SHA-1', format => 'hex'},
    encode_check_method => 'check_password',
}

#SHA-256 / base64 encoding / generate check method
__PACKAGE__->add_columns(
  'password' => {
    data_type   => 'CHAR',
    size        => 40,
    encode_column => 1,
    encode_class  => 'Digest',
    encode_check_method => 'check_password',
    #no  encode_args necessary because these are the defaults ...
}

DESCRIPTION

ACCEPTED ARGUMENTS

digest_encoding

The encoding to use for the digest. Valid values are 'binary', 'hex', and 'base64'. Will default to 'base64' if not specified.

digest_algorithm

The digest algorithm to use for the digest. You may specify any valid Digest algorithm. Examples are MD5, SHA-1, Whirlpool etc. Will default to 'SHA-256' if not specified.

See Digest for supported digest algorithms.

METHODS

make_encode_sub $column_name, \%encode_args

Returns a coderef that accepts a plaintext value and returns an encoded value

make_check_sub $column_name, \%encode_args

Returns a coderef that when given the row object and a plaintext value will return a boolean if the plaintext matches the encoded value. This is typically used for password authentication.

SEE ALSO

DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt, DBIx::Class::EncodedColumn, Digest

AUTHOR

Guillermo Roditi (groditi) <groditi@cpan.org>

Based on the Vienna WoC ToDo manager code by Matt S trout (mst)

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.