in reply to Java to perl conversion

Have a look at Digest::MD5 and you'll see that it has an add method and you won't have to bother with byte arrays.

So,I think you should be able to do something like this, untested code

my $md5 = Digest::MD5->new; $md5->add($key); $md5->add( chr($_) ) for length($key) .. 255; my $tfkey = $md5->digest();

If that doesn't work then you'll have to play around with pack/unpack.