My original best was 63 characters:
sub canonical { my(@a,$i,%c,$c)=pop=~/./g;$c.=$c{$_}||=$a[$i++]for pop=~/./g;$c }
(which is strict compliant, but only because at that point it wasn't any shorter being non-strict compliant. :)

However, here's a 46 character solution building off of btrott's solutions:

sub canonical { ($_,$a,%h)=@_;s!.!$h{$&}||=($a=~/./g,$&)!ge;$_ }
Can be called multiple times, of course, as in the example.

 

Update: Well, tilly's been mumbling something about following the spec :) , so here's a solution that accepts any ASCII character (including zero and linefeed) in the word or the alphabet:
sub canonical { ($_,$a,%h)=@_;s!.!{$h{$&}=~s+^\z+$a=~/./gs,$&+ge}$h{$&}!gse;$_ }
At 62, it actually beats my original solution by 1 character!

In reply to Re: (Golf) Cryptographer's Tool #1 by chipmunk
in thread (Golf) Cryptographer's Tool #1 by Masem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":