Improve auth code generation algorithm.