improved speed of hash calculation