$theText = "abc def ghi"; print "this value for $theText == " , ghash($theText), "\n"; $theText = "acb def ghi"; print "this value for $theText == " , ghash($theText), "\n"; ##################### sub ghash() { my ($str) = @_; my $y = length($str); my $ret = 0; for(my $i = 0; $i < $y; ) { $ret += ord( substr($str, $i,1)) * (++$i); } return $ret; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Quick and Dirty Hash
by roboticus (Chancellor) on Jun 22, 2006 at 01:52 UTC | |
Re: Quick and Dirty Hash
by GrandFather (Saint) on Jun 22, 2006 at 04:08 UTC | |
Re: Quick and Dirty Hash
by japhy (Canon) on Jun 22, 2006 at 01:03 UTC | |
by clancey (Initiate) on Jun 22, 2006 at 02:54 UTC | |
by japhy (Canon) on Jun 22, 2006 at 03:10 UTC | |
Re: Quick and Dirty Hash
by TedPride (Priest) on Jun 22, 2006 at 04:36 UTC | |
Re: Quick and Dirty Hash
by davidrw (Prior) on Jun 22, 2006 at 01:58 UTC | |
Re: Quick and Dirty Hash
by ikegami (Patriarch) on Jun 22, 2006 at 02:45 UTC | |
Re: Quick and Dirty Hash
by hrr (Monk) on Jun 29, 2006 at 13:58 UTC |