1DBIx::Class::EncodedColUusmenr::CDoingtersitb(u3t)ed PerDlBIDxo:c:uCmleanstsa:t:iEonncodedColumn::Digest(3)
2
3
4

NAME

6       DBIx::Class::EncodedColumn::Digest - Digest backend
7

SYNOPSYS

9         #SHA-1 / hex encoding / generate check method
10         __PACKAGE__->add_columns(
11           'password' => {
12             data_type   => 'CHAR',
13             size        => 40 + 10,
14             encode_column => 1,
15             encode_class  => 'Digest',
16             encode_args   => {algorithm => 'SHA-1', format => 'hex', salt_length => 10},
17             encode_check_method => 'check_password',
18         }
19
20         #SHA-256 / base64 encoding / generate check method
21         __PACKAGE__->add_columns(
22           'password' => {
23             data_type   => 'CHAR',
24             size        => 40,
25             encode_column => 1,
26             encode_class  => 'Digest',
27             encode_check_method => 'check_password',
28             #no  encode_args necessary because these are the defaults ...
29         }
30

DESCRIPTION

ACCEPTED ARGUMENTS

33   format
34       The encoding to use for the digest. Valid values are 'binary', 'hex',
35       and 'base64'. Will default to 'base64' if not specified.
36
37   algorithm
38       The digest algorithm to use for the digest. You may specify any valid
39       Digest algorithm. Examples are MD5, SHA-1, Whirlpool etc. Will default
40       to 'SHA-256' if not specified.
41
42       See Digest for supported digest algorithms.
43
44   salt_length
45       If you would like to use randomly generated salts to encode values make
46       sure this option is set to > 0. Salts will be automatically generated
47       at encode time and will be appended to the end of the digest. Please
48       make sure that you remember to make sure that to expand the size of
49       your db column to have enough space to store both the digest AND the
50       salt. Please see list below for common digest lengths.
51

METHODS

53   make_encode_sub $column_name, \%encode_args
54       Returns a coderef that takes two arguments, a plaintext value and an
55       optional salt and returns the encoded value with the salt appended to
56       the end of the digest. If a salt is not provided and the salt_length
57       option was greater than zero it will be randomly generated.
58
59   make_check_sub $column_name, \%encode_args
60       Returns a coderef that takes the row object and a plaintext value and
61       will return a boolean if the plaintext matches the encoded value. This
62       is typically used for password authentication.
63

COMMON DIGEST LENGTHS

65            CIPHER    | Binary | Base64 |  Hex
66          ---------------------------------------
67          | MD2       |   16   |   22   |  32  |
68          | MD4       |   16   |   22   |  32  |
69          | MD5       |   16   |   22   |  32  |
70          | SHA-1     |   20   |   27   |  40  |
71          | SHA-256   |   32   |   43   |  64  |
72          | SHA-384   |   48   |   64   |  96  |
73          | SHA-512   |   64   |   86   | 128  |
74          | CRC-CCITT |    3   |    2   |   3  |
75          | CRC-16    |    5   |    6   |   4  |
76          | CRC-32    |   10   |   14   |   8  |
77          | Adler-32  |    4   |    6   |   8  |
78          | Whirlpool |   64   |   86   | 128  |
79          | Haval-256 |   32   |   44   |  64  |
80          ---------------------------------------
81

SEE ALSO

83       DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt,
84       DBIx::Class::EncodedColumn, Digest
85

AUTHOR

87       Guillermo Roditi (groditi) <groditi@cpan.org>
88
89       Based on the Vienna WoC  ToDo manager code by Matt S trout (mst)
90

CONTRIBUTORS

92       See DBIx::Class::EncodedColumn
93

LICENSE

95       This module is free software; you can redistribute it and/or modify it
96       under the same terms as Perl itself.
97
98
99
100perl v5.28.0                      2016-05-D3B1Ix::Class::EncodedColumn::Digest(3)
Impressum