1DBIx::Class::EncodedColUusmenr::CDoingtersitb(u3tpemd)PDeBrIlx:D:oCcluamsesn:t:aEtnicoondedColumn::Digest(3pm)
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   => {
17                 algorithm   => 'SHA-1',
18                 format      => 'hex',
19                 salt_length => 10,
20                 charset     => 'utf-8',
21             },
22             encode_check_method => 'check_password',
23         }
24
25         #SHA-256 / base64 encoding / generate check method
26         __PACKAGE__->add_columns(
27           'password' => {
28             data_type   => 'CHAR',
29             size        => 40,
30             encode_column => 1,
31             encode_class  => 'Digest',
32             encode_check_method => 'check_password',
33             #no  encode_args necessary because these are the defaults ...
34         }
35

DESCRIPTION

ACCEPTED ARGUMENTS

38   format
39       The encoding to use for the digest. Valid values are 'binary', 'hex',
40       and 'base64'. Will default to 'base64' if not specified.
41
42   algorithm
43       The digest algorithm to use for the digest. You may specify any valid
44       Digest algorithm. Examples are MD5, SHA-1, Whirlpool etc. Will default
45       to 'SHA-256' if not specified.
46
47       See Digest for supported digest algorithms.
48
49   salt_length
50       If you would like to use randomly generated salts to encode values make
51       sure this option is set to > 0. Salts will be automatically generated
52       at encode time and will be appended to the end of the digest. Please
53       make sure that you remember to make sure that to expand the size of
54       your db column to have enough space to store both the digest AND the
55       salt. Please see list below for common digest lengths.
56
57   charset
58       If the string is not restricted to ASCII, then you will need to specify
59       a character set encoding.
60
61       See Encode for a list of encodings.
62

METHODS

64   make_encode_sub $column_name, \%encode_args
65       Returns a coderef that takes two arguments, a plaintext value and an
66       optional salt and returns the encoded value with the salt appended to
67       the end of the digest. If a salt is not provided and the salt_length
68       option was greater than zero it will be randomly generated.
69
70   make_check_sub $column_name, \%encode_args
71       Returns a coderef that takes the row object and a plaintext value and
72       will return a boolean if the plaintext matches the encoded value. This
73       is typically used for password authentication.
74

COMMON DIGEST LENGTHS

76            CIPHER    | Binary | Base64 |  Hex
77          ---------------------------------------
78          | MD2       |   16   |   22   |  32  |
79          | MD4       |   16   |   22   |  32  |
80          | MD5       |   16   |   22   |  32  |
81          | SHA-1     |   20   |   27   |  40  |
82          | SHA-256   |   32   |   43   |  64  |
83          | SHA-384   |   48   |   64   |  96  |
84          | SHA-512   |   64   |   86   | 128  |
85          | CRC-CCITT |    3   |    2   |   3  |
86          | CRC-16    |    5   |    6   |   4  |
87          | CRC-32    |   10   |   14   |   8  |
88          | Adler-32  |    4   |    6   |   8  |
89          | Whirlpool |   64   |   86   | 128  |
90          | Haval-256 |   32   |   44   |  64  |
91          ---------------------------------------
92

SEE ALSO

94       DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt,
95       DBIx::Class::EncodedColumn, Digest
96

AUTHOR

98       Guillermo Roditi (groditi) <groditi@cpan.org>
99
100       Based on the Vienna WoC  ToDo manager code by Matt S trout (mst)
101

CONTRIBUTORS

103       See DBIx::Class::EncodedColumn
104

LICENSE

106       This module is free software; you can redistribute it and/or modify it
107       under the same terms as Perl itself.
108
109
110
111perl v5.36.0                      2022-0D7B-I2x2::Class::EncodedColumn::Digest(3pm)
Impressum