[Bast-commits] r4003 - in trunk/DBIx-Class-EncodedColumn: . lib/DBIx/Class lib/DBIx/Class/EncodedColumn

groditi at dev.catalyst.perl.org groditi at dev.catalyst.perl.org
Fri Feb 1 00:14:04 GMT 2008


Author: groditi
Date: 2008-02-01 00:14:04 +0000 (Fri, 01 Feb 2008)
New Revision: 4003

Modified:
   trunk/DBIx-Class-EncodedColumn/Changes
   trunk/DBIx-Class-EncodedColumn/Makefile
   trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm
   trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn/Digest.pm
Log:
POD Changes and fixed Changelog

Modified: trunk/DBIx-Class-EncodedColumn/Changes
===================================================================
--- trunk/DBIx-Class-EncodedColumn/Changes	2008-01-31 23:20:45 UTC (rev 4002)
+++ trunk/DBIx-Class-EncodedColumn/Changes	2008-02-01 00:14:04 UTC (rev 4003)
@@ -1,4 +1,9 @@
-0.00001_01     2008-01-31
+0.00001_03     2008-01-31
+        - Pod Changes and corrections
+        - Added common digest lengths table
+
+0.00001_02     2008-01-31
         -salt additions & little fixes
+
 0.00001_01     2008-01-29
 	- Initial release

Modified: trunk/DBIx-Class-EncodedColumn/Makefile
===================================================================
--- trunk/DBIx-Class-EncodedColumn/Makefile	2008-01-31 23:20:45 UTC (rev 4002)
+++ trunk/DBIx-Class-EncodedColumn/Makefile	2008-02-01 00:14:04 UTC (rev 4003)
@@ -18,7 +18,7 @@
 #     NO_META => q[1]
 #     PL_FILES => {  }
 #     PREREQ_PM => { Test::More=>q[0], SQL::Translator=>q[0.08000], DBD::SQLite=>q[0], File::Spec=>q[0], Digest::SHA=>q[0], DBIx::Class=>q[0.06002] }
-#     VERSION => q[0.00001_01]
+#     VERSION => q[0.00001_02]
 #     dist => { PREOP=>q[$(PERL) -I. "-MModule::Install::Admin" -e "dist_preop(q($(DISTVNAME)))"] }
 #     test => { TESTS=>q[t/01load.t t/02digest.t] }
 
@@ -60,11 +60,11 @@
 DFSEP = $(DIRFILESEP)
 NAME = DBIx::Class::EncodedColumn
 NAME_SYM = DBIx_Class_EncodedColumn
-VERSION = 0.00001_01
+VERSION = 0.00001_02
 VERSION_MACRO = VERSION
-VERSION_SYM = 0_00001_01
+VERSION_SYM = 0_00001_02
 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
-XS_VERSION = 0.00001_01
+XS_VERSION = 0.00001_02
 XS_VERSION_MACRO = XS_VERSION
 XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
 INST_ARCHLIB = blib/arch
@@ -263,7 +263,7 @@
 DIST_CP = best
 DIST_DEFAULT = tardist
 DISTNAME = DBIx-Class-EncodedColumn
-DISTVNAME = DBIx-Class-EncodedColumn-0.00001_01
+DISTVNAME = DBIx-Class-EncodedColumn-0.00001_02
 
 
 # --- MakeMaker macro section:
@@ -775,7 +775,7 @@
 # --- MakeMaker ppd section:
 # Creates a PPD (Perl Package Description) for a binary distribution.
 ppd :
-	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,00001_01,0,0">' > $(DISTNAME).ppd
+	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0,00001_02,0,0">' > $(DISTNAME).ppd
 	$(NOECHO) $(ECHO) '    <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
 	$(NOECHO) $(ECHO) '    <ABSTRACT>Automatically encode column values</ABSTRACT>' >> $(DISTNAME).ppd
 	$(NOECHO) $(ECHO) '    <AUTHOR>Guillermo Roditi (groditi) &lt;groditi at cpan.org&gt;</AUTHOR>' >> $(DISTNAME).ppd

Modified: trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn/Digest.pm
===================================================================
--- trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn/Digest.pm	2008-01-31 23:20:45 UTC (rev 4002)
+++ trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn/Digest.pm	2008-02-01 00:14:04 UTC (rev 4003)
@@ -86,10 +86,10 @@
   __PACKAGE__->add_columns(
     'password' => {
       data_type   => 'CHAR',
-      size        => 40,
+      size        => 40 + 10,
       encode_column => 1,
       encode_class  => 'Digest',
-      encode_args   => {algorithm => 'SHA-1', format => 'hex'},
+      encode_args   => {algorithm => 'SHA-1', format => 'hex', salt_length => 10},
       encode_check_method => 'check_password',
   }
 
@@ -109,12 +109,12 @@
 
 =head1 ACCEPTED ARGUMENTS
 
-=head2 digest_encoding
+=head2 format
 
 The encoding to use for the digest. Valid values are 'binary', 'hex', and
 'base64'. Will default to 'base64' if not specified.
 
-=head2 digest_algorithm
+=head2 algorithm
 
 The digest algorithm to use for the digest. You may specify any valid L<Digest>
 algorithm. Examples are L<MD5|Digest::MD5>, L<SHA-1|Digest::SHA>,
@@ -122,18 +122,49 @@
 
 See L<Digest> for supported digest algorithms.
 
+=head2 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. Please make sure that you
+remember to make sure that to expand the size of your db column to have enough
+space to store both the digest AND the salt. Please see list below for common
+digest lengths.
+
 =head1 METHODS
 
 =head2 make_encode_sub $column_name, \%encode_args
 
-Returns a coderef that accepts a plaintext value and returns an encoded value
+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.
 
 =head2 make_check_sub $column_name, \%encode_args
 
-Returns a coderef that when given the row object and a plaintext value will
+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.
 
+=head1 COMMON DIGEST LENGTHS
+
+     CIPHER    | Binary | Base64 |  Hex
+   ---------------------------------------
+   | MD2       |   16   |   22   |  32  |
+   | MD4       |   16   |   22   |  32  |
+   | MD5       |   16   |   22   |  32  |
+   | SHA-1     |   20   |   27   |  40  |
+   | SHA-256   |   32   |   43   |  64  |
+   | SHA-384   |   48   |   64   |  96  |
+   | SHA-512   |   64   |   86   | 128  |
+   | CRC-CCITT |    3   |    2   |   3  |
+   | CRC-16    |    5   |    6   |   4  |
+   | CRC-32    |   10   |   14   |   8  |
+   | Adler-32  |    4   |    6   |   8  |
+   | Whirlpool |   64   |   86   | 128  |
+   | Haval-256 |   32   |   44   |  64  |
+   ---------------------------------------
+
 =head1 SEE ALSO
 
 L<DBIx::Class::EncodedColumn::Crypt::Eksblowfish::Bcrypt>,

Modified: trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm
===================================================================
--- trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm	2008-01-31 23:20:45 UTC (rev 4002)
+++ trunk/DBIx-Class-EncodedColumn/lib/DBIx/Class/EncodedColumn.pm	2008-02-01 00:14:04 UTC (rev 4003)
@@ -88,10 +88,10 @@
   __PACKAGE__->add_columns(
     'password' => {
       data_type   => 'CHAR',
-      size        => 40,
+      size        => 40 + 10,
       encode_column => 1,
       encode_class  => 'Digest',
-      encode_args   => {algorithm => 'SHA-1', format => 'hex'},
+      encode_args   => {algorithm => 'SHA-1', format => 'hex', salt_length => 10},
       encode_check_method => 'check_password',
   }
 




More information about the Bast-commits mailing list