Java tutorial
//package com.java2s; public class Main { public static int bernstein(String key) { int hash = 0; int i; for (i = 0; i < key.length(); ++i) hash = 33 * hash + key.charAt(i); return hash; } }