Hello, I am taking a java course this fall; And right now we're in the String library, and the java hashcode function that we have in java I'd think make a good addition to some lua hashes around here. its not as secure as other hashes however it does work.

So here it is:

http://pastebin.com/duwcL34w

or run
pastebin get duwcL34w strHashCode

to use it simply call the jsh function once loaded.

Example (pass a filename as an arument)

local function jsh(str)
local hash = 0
local strn = string.len(str)
for i = 1, strn do
  char = string.byte(string.sub(str, i,i))
  hash = bit32.lshift(hash, 5) - hash + char
end
return hash
end
args = {...}
local fh = fs.open(args[1], "r")
local d = fh.readAll()
fh.close()
print(jsh(d))