Prevent generateHash from being run multiple times simultaneously