Commit a7d3d67f authored by sikeda's avatar sikeda
Browse files

[-dev] tools::md5_fingerprint() was deprecated. Use Digest::MD5::md5_hex() directly.

git-svn-id: https://subversion.renater.fr/sympa/branches/sympa-6.2-branch@11374 05aa8bb8-cd2b-0410-b1d7-8918dfa770ce
parent 88ec2caa
......@@ -49,6 +49,7 @@ use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--';
use Archive::Zip qw();
use DateTime;
use DateTime::Format::Mail;
use Digest::MD5;
use Encode qw();
use English; # FIXME: drop $MATCH usage
use MIME::EncWords;
......@@ -21185,7 +21186,7 @@ sub do_upload_pictures {
return 'suboptions';
}
 
my $filename = tools::md5_fingerprint($param->{'user'}{'email'});
my $filename = Digest::MD5::md5_hex($param->{'user'}{'email'});
my $fullfilename = $filename . '.' . $filetype;
 
my @filetmp;
......
......@@ -26,6 +26,7 @@ package Sympa::Auth;
use strict;
use warnings;
use Digest::MD5;
use POSIX qw();
use Conf;
......@@ -48,9 +49,9 @@ sub password_fingerprint {
my $pwd = shift;
if (Conf::get_robot_conf('*', 'password_case') eq 'insensitive') {
return tools::md5_fingerprint(lc($pwd));
return Digest::MD5::md5_hex(lc($pwd));
} else {
return tools::md5_fingerprint($pwd);
return Digest::MD5::md5_hex($pwd);
}
}
......@@ -410,7 +411,7 @@ sub remote_app_check_password {
my ($trusted_application_name, $password, $robot) = @_;
Log::do_log('debug', '(%s, %s)', $trusted_application_name, $robot);
my $md5 = tools::md5_fingerprint($password);
my $md5 = Digest::MD5::md5_hex($password);
my $vars;
# seach entry for trusted_application in Conf
......
......@@ -26,6 +26,7 @@ package Sympa::Bulk;
use strict;
use warnings;
use Digest::MD5;
use MIME::Base64 qw();
use MIME::Parser;
use Term::ProgressBar;
......@@ -35,7 +36,6 @@ use Time::HiRes qw();
use Conf;
use Log;
use SDM;
use tools;
use Sympa::Tools::Daemon;
## Database and SQL statement handlers
......@@ -290,7 +290,7 @@ sub store {
##-----------------------------##
my $msg = MIME::Base64::encode($message->to_string);
my $messagekey = tools::md5_fingerprint($msg);
my $messagekey = Digest::MD5::md5_hex($msg);
# first store the message in bulk_spool_table
# because as soon as packet are created bulk.pl may distribute them
......@@ -394,7 +394,7 @@ sub store {
} else {
$rcptasstring = $packet;
}
my $packetid = tools::md5_fingerprint($rcptasstring);
my $packetid = Digest::MD5::md5_hex($rcptasstring);
my $packet_already_exist;
if ($message_already_on_spool) {
## search if this packet is already in spool database : mailfile
......@@ -635,7 +635,7 @@ sub store_test {
);
$priority_message = 9;
my $messagekey = tools::md5_fingerprint(Time::HiRes::time());
my $messagekey = Digest::MD5::md5_hex(Time::HiRes::time());
my $msg = '';
$progress->max_update_rate(1);
my $next_update = 0;
......
......@@ -3491,7 +3491,7 @@ sub find_picture_filenames {
my $self = shift;
my $email = shift;
my $login = tools::md5_fingerprint($email);
my $login = Digest::MD5::md5_hex($email);
my @ret = ();
foreach my $ext (qw{gif jpg jpeg png}) {
......@@ -5367,7 +5367,7 @@ sub update_list_member {
foreach my $path ($self->find_picture_paths($who)) {
my $extension = [reverse split /\./, $path]->[0];
my $new_path = $self->get_picture_path(
tools::md5_fingerprint($values->{'email'}) . '.'
Digest::MD5::md5_hex($values->{'email'}) . '.'
. $extension);
unless (rename $path, $new_path) {
Log::do_log('err', 'Failed to rename %s to %s : %m',
......
......@@ -1500,30 +1500,8 @@ sub add_in_blacklist {
# DEPRECATED: No longer used.
# sub get_fingerprint($email, $fingerprint);
############################################################
# md5_fingerprint #
############################################################
# The algorithm MD5 (Message Digest 5) is a cryptographic #
# hash function which permit to obtain #
# the fingerprint of a file/data #
# #
# IN : a string #
# #
# OUT : md5 digest #
# | undef #
# #
############################################################
sub md5_fingerprint {
my $input_string = shift;
return undef unless (defined $input_string);
chomp $input_string;
my $digestmd5 = Digest::MD5->new;
$digestmd5->reset;
$digestmd5->add($input_string);
return (unpack("H*", $digestmd5->digest));
}
# DEPRECATED: Use Digest::MD5::md5_hex.
#sub md5_fingerprint($input_string);
# DEPRECATED: No longer used.
# sub get_db_random();
......
......@@ -26,6 +26,7 @@
use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--';
use strict;
use warnings;
use Digest::MD5;
use English qw(-no_match_vars);
use File::Copy qw();
use Getopt::Long;
......@@ -606,7 +607,7 @@ while ($signal ne 'term') { #as long as a signal is not received }
}
exit 0;
} elsif ($main::options{'md5_digest'}) {
my $md5 = tools::md5_fingerprint($main::options{'md5_digest'});
my $md5 = Digest::MD5::md5_hex($main::options{'md5_digest'});
printf "md5 digest : $md5 \n";
exit 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment