summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2002-07-17 17:06:44 +0000
committerPeter Palfrader <peter@palfrader.org>2002-07-17 17:06:44 +0000
commit0de702218fe446ccf8342e41ce32dff871b03fdd (patch)
treecf2c0a2e83da15141e6baf2cc71f03556b4d4da3 /Echolot
parent6e34ee5124cea160f08736992629c6760949bb1a (diff)
moved makeHash to Tools
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Pinger.pm13
-rw-r--r--Echolot/Tools.pm11
2 files changed, 12 insertions, 12 deletions
diff --git a/Echolot/Pinger.pm b/Echolot/Pinger.pm
index 18f72f9..57efaa8 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.15 2002/07/17 16:14:23 weasel Exp $
+# $Id: Pinger.pm,v 1.16 2002/07/17 17:06:44 weasel Exp $
#
=pod
@@ -22,15 +22,6 @@ use English;
use Echolot::Pinger::Mix;
use Echolot::Pinger::CPunk;
-sub makeHash($) {
- my ($text) = @_;
-
- my $hash = Echolot::Tools::make_mac($text);
- $hash = substr($hash, 0, 4);
- my $sum = hex($hash);
- return $sum;
-};
-
sub do_mix_ping($$$$$) {
my ($address, $keyid, $time, $to, $body) = @_;
@@ -109,7 +100,7 @@ sub send_pings() {
for my $type (Echolot::Globals::get()->{'storage'}->get_types($address)) {
next unless Echolot::Config::get()->{'do_pings'}->{$type};
for my $key (Echolot::Globals::get()->{'storage'}->get_keys($address, $type)) {
- next unless ($this_call_id eq (makeHash($address.$type.$key) % $send_every_n_calls));
+ next unless ($this_call_id eq (Echolot::Tools::makeShortNumHash($address.$type.$key) % $send_every_n_calls));
print "ping calling $type, $address, $key\n" if Echolot::Config::get()->{'verbose'};
do_ping($type, $address, $key);
}
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index 403c02b..e4bed61 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -1,7 +1,7 @@
package Echolot::Tools;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Tools.pm,v 1.6 2002/07/16 02:48:57 weasel Exp $
+# $Id: Tools.pm,v 1.7 2002/07/17 17:06:44 weasel Exp $
#
=pod
@@ -54,6 +54,15 @@ sub make_mac($) {
return $mac;
};
+sub makeShortNumHash($) {
+ my ($text) = @_;
+
+ my $hash = Echolot::Tools::make_mac($text);
+ $hash = substr($hash, 0, 4);
+ my $sum = hex($hash);
+ return $sum;
+};
+
sub verify_mac($$) {
my ($token, $mac) = @_;