summaryrefslogtreecommitdiff
path: root/Echolot/Pinger.pm
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-07-17 16:14:23 +0000
committerPeter Palfrader <peter@palfrader.org>2002-07-17 16:14:23 +0000
commit4944ef59b95764a4b5333c7846f2f58dc62ffa5e (patch)
tree6b87e1ba4d887d0cc12a9a3438a1b13ae50f9557 /Echolot/Pinger.pm
parenta08e5f2c5751d07a77b8d7a87adfb0f789fafb51 (diff)
The cheap hashing function that was used for determining when to ping was replaced by md5. The local secret also is an input to the function so not all echolot pingers ping the same remailer at the same time.
Diffstat (limited to 'Echolot/Pinger.pm')
-rw-r--r--Echolot/Pinger.pm11
1 files changed, 5 insertions, 6 deletions
diff --git a/Echolot/Pinger.pm b/Echolot/Pinger.pm
index d996427..18f72f9 100644
--- a/Echolot/Pinger.pm
+++ b/Echolot/Pinger.pm
@@ -1,7 +1,7 @@
package Echolot::Pinger;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Pinger.pm,v 1.14 2002/07/17 02:36:07 weasel Exp $
+# $Id: Pinger.pm,v 1.15 2002/07/17 16:14:23 weasel Exp $
#
=pod
@@ -22,13 +22,12 @@ use English;
use Echolot::Pinger::Mix;
use Echolot::Pinger::CPunk;
-my @primes = qw{13 1997 173 1051 59 6 97883 197 3 2 109 127 7};
sub makeHash($) {
my ($text) = @_;
- my $sum = 0;
- for (my $i=0; $i < length($text); $i++) {
- $sum += ord( substr($text, $i, 1) ) * $primes[ $i % (scalar @primes) ];
- };
+
+ my $hash = Echolot::Tools::make_mac($text);
+ $hash = substr($hash, 0, 4);
+ my $sum = hex($hash);
return $sum;
};