my $ms = $ml < $MAX_CHUNK_SIZE ? $ml : $MAX_CHUNK_SIZE; for my $piece ( 0..$num_pieces - 1 ) { my $ss = substr($message, $piece * $MAX_CHUNK_SIZE, $ms); # fine up to here... my $ssl = length $ss; my @message = unpack( "C*", $ss ); ### at this point the characters are changed... we go from 32 to 37 characters (in the array). why? # i've changed the code in the RC4 package here slightly to allow testing. # it produces identical results in all cases considered here.