added the hash checking function