use Digest::MD5;
my $md5 = Digest::MD5->new;
use Digest::MD5 qw(md5_hex);
my $idnum = md5_hex($ENV{'REMOTE_ADDR'});
$idnum = substr($idnum,-4);
$md5->add($idnum);
$md5->add($FORM{"bbs"});
$md5->add(substr($DATE,6,2));
my $md5datefile = "************";
if(-e $md5datefile){
open(MD5FILE,"<$md5datefile");
my $md5line = <MD5FILE>;
close(MD5FILE);
my ($md5date,$md5number) = split /<>/,$md5line;
if($md5date eq $MD5DATE){
$md5->add($md5number);
}else{
open(MD5FILE,">$md5datefile");
my $data = "";
sysopen(RANDOM, "/dev/random", O_READ) || die "cannot open /dev/random $!\n";
sysread(RANDOM, $data, 16);
close(RANDOM);
print MD5FILE "$MD5DATE<>$data";
close(MD5FILE);
$md5->add($data);
}