check digit calculation