Update Hasher class, and some general function. Add Gfunction.