Updated hash calculation