DBIx::...Digest(3pm)
π NAME π
DBIx::Class::EncodedColumn::Digest β the Digest backend, bestie. This is the DBIx::...Digest(3pm) manual page from User Contributed Perl Documentation, and itβs giving βpassword encoding but make it cryptographicβ π
β¨
π SYNOPSYS π
#SHA-1 / hex encoding / generate check method
__PACKAGE__->add_columns(
'password' => {
data_type => 'CHAR',
size => 40 + 10,
encode_column => 1,
encode_class => 'Digest',
encode_args => {
algorithm => 'SHA-1',
format => 'hex',
salt_length => 10,
charset => 'utf-8',
},
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 π
This is the Digest backend. The accepted arguments are the main character right below, bestie π«Ά
π¦ ACCEPTED ARGUMENTS π¦
𧬠format
The encoding to use for the digest. Valid values are 'binary', 'hex', and 'base64'. Will default to 'base64' if not specified. Slay.
π§ͺ 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 π
π§ salt_length
If you would like to use randomly generated salts to encode values, make sure this option is set to > 0. Salts will be automatically generated at encode time and will be appended to the end of the digest.
Important bestie: please remember to expand the size of your db column so thereβs enough space to store both the digest AND the salt π Please see the list below for common digest lengths.
π€ charset
If the string is not restricted to ASCII, then you will need to specify a character set encoding.
See Encode for a list of encodings πΈ
π οΈ METHODS π οΈ
β¨ make_encode_sub $column_name, \%encode_args
Returns a coderef that takes two arguments, a plaintext value and an optional salt, and returns the encoded value with the salt appended to the end of the digest. If a salt is not provided and the salt_length option was greater than zero, it will be randomly generated.
β
make_check_sub $column_name, \%encode_args
Returns a coderef that takes the row object and a plaintext value and will return a boolean if the plaintext matches the encoded value. This is typically used for password authentication. Iconic behavior, no cap π₯
π COMMON DIGEST LENGTHS π
The columns are CIPHER, Binary, Base64, and Hex, bestie:
MD2β Binary16, Base6422, Hex32MD4β Binary16, Base6422, Hex32MD5β Binary16, Base6422, Hex32SHA-1β Binary20, Base6427, Hex40SHA-256β Binary32, Base6443, Hex64SHA-384β Binary48, Base6464, Hex96SHA-512β Binary64, Base6486, Hex128CRC-CCITTβ Binary3, Base642, Hex3CRC-16β Binary5, Base646, Hex4CRC-32β Binary10, Base6414, Hex8Adler-32β Binary4, Base646, Hex8Whirlpoolβ Binary64, Base6486, Hex128Haval-256β Binary32, Base6444, Hex64
π SEE ALSO π
DBIx::Class::EncodedColumn::Crypt::Eksblowfish::BcryptDBIx::Class::EncodedColumnDigest
βοΈ AUTHOR βοΈ
Guillermo Roditi (groditi) <groditi@cpan.org>
Based on the Vienna WoC ToDo manager code by Matt S trout (mst)
π«Ά CONTRIBUTORS π«Ά
See DBIx::Class::EncodedColumn
π LICENSE π
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Thatβs the whole manual, bestie π«Ά β source: User Contributed Perl Documentation, version perl v5.40.1, dated 2025-04-01, manual page DBIx::...Digest(3pm). Periodt π
π¦ where this page comes from
- debian trixie: libdbix-class-encodedcolumn-perl 0.00020-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdbix-class-encodedcolumn-perl 0.00020-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdbix-class-encodedcolumn-perl 0.00020-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms