[Dbix-class] Re: A better Digest / Encoding / Encryption Component
Guillermo Roditi
groditi at gmail.com
Tue Jan 29 23:52:44 GMT 2008
Please see working draft, with tests and docs at:
DBIx::Class::EncodedColumn available in the BAST repo and as a dev
release on CPAN (should hit your mirror shortly).
example code:
__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',
}
#MD5 / base64 encoding / generate check method
__PACKAGE__->add_columns(
'password' => {
data_type => 'CHAR',
size => 22,
encode_column => 1,
encode_class => 'Digest',
encode_args => {algorithm => 'MD5', format => 'base64'},
digest_check_method => 'check_password',
}
#Eksblowfish bcrypt / cost of 8/ no key_nul / generate check method
__PACKAGE__->add_columns(
'password' => {
data_type => 'CHAR',
size => 22,
encode_column => 1,
encode_class => 'Crypt::Eksblowfish::Bcrypt',
encode_args => { key_nul => 0, cost => 8 },
digest_check_method => 'check_password',
}
--Guillermo Roditi (groditi)
On Jan 29, 2008 1:41 PM, Guillermo Roditi <groditi at gmail.com> wrote:
> After last night's initial release of DigestOnSet a couple of
> suggestions / issues came up:
>
> -- I forgot to add a 'salt' slot. (Doh!)
> -- We really should make this more flexible, so we can use modules
> outside of the Digest::* family
> -- The name kind of sucks.
>
>
> What I am looking for is ideas. If you keep digests in your database
> let me know what could be easier and what could be more flexible.
> -- What do you do and how do you do it?
> -- How would you like to see a solution be implemented?
> -- What would make development easier?
> -- Are you interested in seeing 2-way ciphers be supported?
> -- What are the essential ciphers that I should include support for
> (besides the Digest::* family)
>
> Tentative name is "DBIx::Class::EncodedColumn"
>
>
> Tentative API:
>
> name => 'password',
> data_type => 'char',
> size => 43,
> encode_column => 1,
> encode_class => (Digest|Crypt|SOmeThingElse),
> encode_args =>
> {
> pre_salt => 'string',
> post_salt => 'other string',
> algorithm => 'SHA-256',
> format => 'base64',
> check_method => 'check_password',
> }
>
>
> -------------------------------------------------
>
> name => 'password',
> data_type => 'char',
> size => 43,
> encode_column => 1,
> encode_class => "Crypt::Eksblowfish::Bcrypt",
> encode_args =>
> {
> #salt gets generated automatically for this one
> cost => 8,
> key_nul => 1,
> check_method => 'check_password',
> }
>
>
>
> --Guillermo Roditi
>
More information about the DBIx-Class
mailing list