hash functions

hello i have a problem with making a code with a hash function
my method is

private int hash(String word)
{
int hashValue = 0;
for(int i = 0; i < word.length(); i++)
hashValue = ((hashValue << 5) + (word.charAt(i)-'a')) % M;

return hashValue;
}

however it only works for lowercase letters and i need it to work for numbers lowercase and uppercase
[427 byte] By [Mykullski] at [2007-11-20 11:21:49]
# 1 Re: hash functions
Saying it doesn't work isn't very helpful. In what way doesn't it work? ie what do you want it to do and what is it actually doing?
keang at 2007-11-10 2:14:05 >
# 2 Re: hash functions
What are you trying to hash? what would you consider a successful hash value?

Good teaching is more a giving of the right questions than a giving of the right answers...
J. Albers
dlorde at 2007-11-10 2:15:16 >
# 3 Re: hash functions
i figured it out sry

the code is

private int hash(String word)
{
int hashValue = 0;
for(int i = 0; i < word.length(); i++)
hashValue = ((hashValue << 6) + (word.charAt(i)-'0')) % M;

return hashValue;
}
Mykullski at 2007-11-10 2:16:14 >