3 # This module impliments the verification routines
5 # Copyright (c) 2002 Dirk Koopman G1TLH
15 use Time::HiRes qw(gettimeofday);
16 use Digest::SHA1 qw(sha1_base64);
20 use vars qw($VERSION $BRANCH);
21 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
22 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ || (0,0));
23 $main::build += $VERSION;
24 $main::branch += $BRANCH;
29 my $self = bless {}, ref($class) || $class;
30 $self->{seed} = shift if @_;
37 my @t = gettimeofday();
38 my $r = unpack("xxNxx", pack("d", rand));
39 @t = map {$_ ^ $r} @t;
40 dbg("challenge r: $r seed: $t[0] $t[1]" ) if isdbg('verify');
41 $r = unpack("xxNxx", pack("d", rand));
42 @t = map {$_ ^ $r} @t;
43 dbg("challenge r: $r seed: $t[0] $t[1]" ) if isdbg('verify');
44 return $self->{seed} = sha1_base64(@t, gettimeofday, rand, rand, rand, @_);
50 return sha1_base64($self->{seed}, @_);
57 my $p = sha1_base64($self->{seed}, @_);