{"record":{"id":"b3cd794ddaddd919","repo":"prestodb/presto","slug":"password-hashing-algorithm-cannot-be-determined","errorCode":null,"errorMessage":"Password hashing algorithm cannot be determined","messagePattern":"Password hashing algorithm cannot be determined","errorType":"validation","errorClass":"HashedPasswordException","httpStatus":null,"severity":"error","filePath":"presto-password-authenticators/src/main/java/com/facebook/presto/password/file/EncryptionUtil.java","lineNumber":113,"sourceCode":"    }\n\n    public static HashingAlgorithm getHashingAlgorithm(String password)\n    {\n        if (password.startsWith(\"$2y\")) {\n            if (getBCryptCost(password) < BCRYPT_MIN_COST) {\n                throw new HashedPasswordException(\"Minimum cost of BCrypt password must be \" + BCRYPT_MIN_COST);\n            }\n            return HashingAlgorithm.BCRYPT;\n        }\n\n        if (password.contains(\":\")) {\n            if (getPBKDF2Iterations(password) < PBKDF2_MIN_ITERATIONS) {\n                throw new HashedPasswordException(\"Minimum iterations of PBKDF2 password must be \" + PBKDF2_MIN_ITERATIONS);\n            }\n            return HashingAlgorithm.PBKDF2;\n        }\n\n        throw new HashedPasswordException(\"Password hashing algorithm cannot be determined\");\n    }\n\n    private static class PBKDF2Password\n    {\n        private final int iterations;\n        private final byte[] salt;\n        private final byte[] hash;\n\n        private PBKDF2Password(int iterations, byte[] salt, byte[] hash)\n        {\n            this.iterations = iterations;\n            this.salt = requireNonNull(salt, \"salt is null\");\n            this.hash = requireNonNull(hash, \"hash is null\");\n        }\n\n        public int iterations()\n        {\n            return iterations;","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-password-authenticators/src/main/java/com/facebook/presto/password/file/EncryptionUtil.java#L95-L131","documentation":"Fallback guard in getHashingAlgorithm: the stored password string is neither a $2y BCrypt hash nor a colon-delimited PBKDF2 record, so no hashing algorithm can be identified for it. Fires when the password file contains an entry in an unrecognized format.","triggerScenarios":"Thrown at presto-password-authenticators/src/main/java/com/facebook/presto/password/file/EncryptionUtil.java:113 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-create the password file entry using the supported BCrypt ($2y...) or PBKDF2 (salt:iterations:hash) formats","Use the provided password generation tooling instead of manual hashing","Validate the password file format before deployment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}