- or download this
use Digest::MD5;
# Given a message and key, returns a message authentication code
...
my $mac = compute_mac(int($score), $secret);
"$score/$mac";
}
- or download this
use CGI;
use CGI::Cookie;
...
$score = authenticated_score($score);
my $cookie = CGI::Cookie->new(-name => 'score', -value => $score);
print header(-cookie=>$cookie);
- or download this
my %cookies = CGI::Cookie->fetch;
$score = $cookies{score}->value;
# Eliminate any score that's been tampered with
$score = 0 unless $score eq authenticated_score($score);
- or download this
my %cookies = CGI::Cookie->fetch;
my $score = $cookies{score}->value;
$score = 0 unless $score eq authenticated_score($score);
...
print header(-cookie=>$cookie);
# (send the rest of your HTML to the player.)