{"record":{"id":"3218d25a841cad3a","repo":"apache/cassandra","slug":"the-requested-digest-algorithm-algorithm-is-n","errorCode":null,"errorMessage":"the requested digest algorithm (${algorithm}) is not available","messagePattern":"the requested digest algorithm \\((.+?)\\) is not available","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/utils/FBUtilities.java","lineNumber":169,"sourceCode":"\n    public static int getAvailableProcessors()\n    {\n        return DatabaseDescriptor.getAvailableProcessors();\n    }\n\n    public static final int MAX_UNSIGNED_SHORT = 0xFFFF;\n\n    public static final int ASM_BYTECODE_VERSION = Opcodes.ASM9;\n\n    public static MessageDigest newMessageDigest(String algorithm)\n    {\n        try\n        {\n            return MessageDigest.getInstance(algorithm);\n        }\n        catch (NoSuchAlgorithmException nsae)\n        {\n            throw new RuntimeException(\"the requested digest algorithm (\" + algorithm + \") is not available\", nsae);\n        }\n    }\n\n    /**\n     * Please use getJustBroadcastAddress instead. You need this only when you have to listen/connect. It's also missing\n     * the port you should be using. 99% of code doesn't want this.\n     */\n    public static InetAddress getJustLocalAddress()\n    {\n        if (localInetAddress == null)\n        {\n            if (DatabaseDescriptor.getListenAddress() == null)\n            {\n                try\n                {\n                    localInetAddress = InetAddress.getLocalHost();\n                    logger.info(\"InetAddress.getLocalHost() was used to resolve listen_address to {}, double check this is \"\n                                + \"correct. Please check your node's config and set the listen_address in cassandra.yaml accordingly if applicable.\",","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/utils/FBUtilities.java#L151-L187","documentation":"FBUtilities.newMessageDigest obtains a JCE MessageDigest for the requested algorithm. If the JVM's security providers do not offer that algorithm, the NoSuchAlgorithmException is wrapped in a RuntimeException naming the algorithm.","triggerScenarios":"Calling FBUtilities.newMessageDigest(\"SHA-1\") (or another algorithm) on a JVM whose installed security providers lack the algorithm — e.g. a stripped/fips-only JCE policy or a custom JDK build.","commonSituations":"Running Cassandra on a FIPS-restricted JVM where SHA-1 or MD5 is disabled, minimal/custom JRE distributions missing standard providers, typos in algorithm names when code paths are parameterized.","solutions":["Use a standard full JDK (Oracle/OpenJDK) that includes the SUN/SecureRandom providers with SHA-1/MD5","If on a FIPS/restricted provider set, register a provider that supplies the required digest (e.g. BouncyCastle FIPS with SHA-1 allowed) or relax the policy","Verify the exact algorithm string spelling ('SHA-1', 'MD5') matches a JCE standard name"],"exampleFix":"// before\nMessageDigest md = FBUtilities.newMessageDigest(\"SHA1-X\"); // unknown\n// after\nMessageDigest md = FBUtilities.newMessageDigest(\"SHA-1\");","handlingStrategy":"try-catch","validationCode":"boolean digestAvailable(String alg) {\n    try { javax.crypto.SecretKeyFactory.getInstance(alg); return false; } // placeholder\n    catch (Exception e) { return false; }\n}\n// preferred check:\nboolean hasDigest(String alg) {\n    return java.security.Security.getAlgorithms(\"MessageDigest\").contains(alg);\n}","typeGuard":null,"tryCatchPattern":"try {\n    MessageDigest md = FBUtilities.newMessageDigest(\"SHA-1\");\n} catch (RuntimeException e) {\n    // provider missing algorithm: fail fast at startup with a clear message\n    throw new AssertionError(\"JVM lacks required digest provider: \" + e.getMessage(), e);\n}","preventionTips":["Run a full standard JDK with default security providers","On FIPS JVMs, register a provider supplying the required digests","Check Security.getAlgorithms(\"MessageDigest\") at startup before relying on digests"],"tags":["digest","jce","configuration","java"],"backgroundTag":"missing-dependency","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}