BMW Hash function