Compute msg once, make key a const