#!/usr/bin/perl -w

use strict;
use v5.30;

use Digest::MD5 qw(md5_hex);

my $salt = 'zpqevtbw';
# my $salt = 'abc';

my $i = -1001;
my $count = 0;
my %five;
while (1) {
	++$i;
	my $j = $i+1000;
	my $f = md5_hex($salt.$j);
	$five{$1} = $j for $f =~ /(.)\1\1\1\1/g;
	next if $i < 0;
	my $h = md5_hex($salt,$i);
	if ($h =~ /(.)\1\1/) {
		next if !$five{$1} || $five{$1} <= $i;
		say ++$count, " $i $1 in $h, also at $five{$1} ", md5_hex($salt.$five{$1});;
		exit 0 if $count >= 64;
	}
}
