Because of commit 7cd8a4fa3, libscrypt_scrypt can return EINVAL, which is 22. Passing this from libscrypt_check incorrectly returns a failure as a success.
Reported by Achim Stahlberger.
Much more effecient N calculation, and now handles N > 15 (althought you wouldn't want to with today's computers).
Credit to Achim Stahlberger <achim.stahlberger@fun.de>.