Return hash value as integer when possible