$input_string = <<'EOS'; Intra-universe security is easy enough. Inter-universe security will be hard. I have half an idea for something involving audit trails that may work. It may be necessary to backtrack and validate an object recorded path before executing the object. For example, imagine USENET if each host in the Path header was asked to vouch for the object having been there. The ratio of positive answers over total hosts in the trail would determine a "percent of certainty". Combined with an average "percent of trustability" for each host, the current universe would come up with a "total trustability" percent to test against a threshhold. EOS #$input_string = '/WED/WE/WEE/WEB/WET'; $begin_length = length($input_string); $cease_length = 0; # perform LZW compression $next_code = 0; while ($next_code < 256) { $table{chr($next_code)} = $next_code; $next_code++; } $run_start = 0; $run_length = 1; $input_remaining = length($input_string); while ($input_remaining >= $run_length) { if (exists $table{$string = substr($input_string, $run_start, $run_length)}) { $run_length++; next; } $table{$string} = $next_code++; $input_remaining -= --$run_length; $run_start += $run_length; chop $string; print $table{$string},"\t"; $cease_length++; $run_length = 1; } print $table{substr($input_string, $run_start)}, "\n"; $cease_length++; print "Begin length: $begin_length; cease length: $cease_length\n"; printf "Compression: %.2f%%\n", 100 - (($cease_length / $begin_length) * 100);