From: Manni H. <man...@us...> - 2007-12-02 17:27:46
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23155/Classifier Modified Files: Bayes.pm Log Message: Add two global configuration variables, crypt_strength and crypt_device, and use them in calls to Crypt::Random::makerandom_octet. They default to 0 and '', respectively. Advanced users can set crypt_strength to 1, but the average user should be happier with 0. The super-advanced user can even specify his own random device. Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.356 retrieving revision 1.357 diff -C2 -d -r1.356 -r1.357 *** Bayes.pm 2 Dec 2007 13:08:38 -0000 1.356 --- Bayes.pm 2 Dec 2007 17:27:47 -0000 1.357 *************** *** 40,45 **** use Digest::SHA qw( sha256_hex ); use MIME::Base64; ! ! use Crypt::Random; # This is used to get the hostname of the current machine --- 40,44 ---- use Digest::SHA qw( sha256_hex ); use MIME::Base64; ! use Crypt::Random qw( makerandom_octet ); # This is used to get the hostname of the current machine *************** *** 1503,1511 **** # get a random session key in hex ! # TODO: make the Strength parameter configurable with a GLOBAL option ! # and also add the option to specify another Device? ! ! my $random = Crypt::Random::makerandom_octet( Length => 128, ! Strength => 0, Device => '' ); my $now = time; return sha256_hex( "$$" . "$random$now" ); --- 1502,1511 ---- # get a random session key in hex ! $self->log_( 1, "Generating random octet" ); ! my $random = makerandom_octet( ! Length => 128, ! Strength => $self->global_config_( 'crypt_strength' ), ! Device => $self->global_config_( 'crypt_device' ), ! ); my $now = time; return sha256_hex( "$$" . "$random$now" ); |