import sha.pm on ubuntu instands of sha1.pm

This commit is contained in:
xq2005 2013-08-05 01:35:40 -07:00
parent a7e3e9ec2a
commit ecd518e31e
4 changed files with 38 additions and 13 deletions

View File

@ -179,7 +179,13 @@ sub genUUID
return $uuid;
} elsif ($args{url} and $sha1support) { #generate a UUIDv5 from URL
#6ba7b810-9dad-11d1-80b4-00c04fd430c8 is the uuid for URL namespace
my $sum = Digest::SHA1::sha1('6ba7b810-9dad-11d1-80b4-00c04fd430c8'.$args{url});
my $sum = '';
if ( -f "/etc/debian_version" ){
$sum = Digest::SHA::sha1('6ba7b810-9dad-11d1-80b4-00c04fd430c8'.$args{url});
}
else{
$sum = Digest::SHA1::sha1('6ba7b810-9dad-11d1-80b4-00c04fd430c8'.$args{url});
}
my @data = unpack("C*",$sum);
splice @data,16;
$data[6] = $data[6] & 0xf;

View File

@ -19,10 +19,19 @@ use File::Path;
use Socket;
use strict;
use Symbol;
my $sha1support = eval {
require Digest::SHA1;
1;
};
if ( -f "/etc/debian_version" ) {
$sha1support = eval {
require Digest::SHA;
1;
};
}
else {
$sha1support = eval {
require Digest::SHA1;
1;
};
}
use IPC::Open3;
use IO::Select;
use warnings "all";

View File

@ -46,13 +46,24 @@ use Digest::MD5 qw/md5/;
my $pendingpackets=0;
my %tabooseq; #TODO: this is a global which means one taboo in the whole set causes unrelated session objects to consider it taboo unnecessarily
my $maxpending; #determined dynamically based on rcvbuf detection
my $ipmi2support = eval {
require Digest::SHA1;
Digest::SHA1->import(qw/sha1/);
require Digest::HMAC_SHA1;
Digest::HMAC_SHA1->import(qw/hmac_sha1/);
1;
};
if ( -f "/etc/debian_release" ){
$ipmi2support = eval {
require Digest::SHA;
Digest::SHA->import(qw/sha1/);
require Digest::HMAC_SHA1;
Digest::HMAC_SHA1->import(qw/hmac_sha1/);
1;
};
}
else {
$ipmi2support = eval {
require Digest::SHA1;
Digest::SHA1->import(qw/sha1/);
require Digest::HMAC_SHA1;
Digest::HMAC_SHA1->import(qw/hmac_sha1/);
1;
};
}
my $aessupport;
if ($ipmi2support) {
$aessupport = eval {

View File

@ -73,7 +73,6 @@ use IO::Socket;
use IO::Select;
use Class::Struct;
use Digest::MD5 qw(md5);
use Digest::SHA1 qw(sha1);
use POSIX qw(WNOHANG mkfifo strftime);
use Fcntl qw(:flock);