keys: just use snprintf for key generation after 1000.

This is not super common, so the slightly slower snprintf seems the
safest route.