{"record":{"id":"e0e93adc2ad01719","repo":"phalcon/cphalcon","slug":"unsupported-hmac-algorithm","errorCode":null,"errorMessage":"Unsupported HMAC algorithm","messagePattern":"Unsupported HMAC algorithm","errorType":"exception","errorClass":"UnsupportedHmacAlgorithm","httpStatus":null,"severity":"error","filePath":"phalcon/Encryption/Security/JWT/Signer/Hmac.zep","lineNumber":42,"sourceCode":"    /**\n     * Hmac constructor.\n     *\n     * @param string $algo\n     *\n     * @throws UnsupportedAlgorithmException\n     */\n    public function __construct( string algo = \"sha512\")\n    {\n        array supported;\n\n        let supported = [\n            \"sha512\" : 1,\n            \"sha384\" : 1,\n            \"sha256\" : 1\n        ];\n\n        if !isset supported[algo] {\n            throw new UnsupportedHmacAlgorithm();\n        }\n\n        let this->algorithm = algo;\n    }\n\n    /**\n     * Return the value that is used for the \"alg\" header\n     *\n     * @return string\n     */\n    public function getAlgHeader() -> string\n    {\n        return \"HS\" . str_replace(\"sha\", \"\", this->algorithm);\n    }\n\n    /**\n     * Sign a payload using the passphrase\n     *","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Encryption/Security/JWT/Signer/Hmac.zep#L24-L60","documentation":"Thrown by the Hmac signer constructor when the algo argument is not one of the supported hash algorithms ('sha512', 'sha384', 'sha256'). Any other hash name passed to new Hmac() is rejected. Use one of the three supported algorithms.","triggerScenarios":"Thrown at phalcon/Encryption/Security/JWT/Signer/Hmac.zep:42 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of sha512, sha384 or sha256 when constructing the HMAC signer","Pick a different signer class (e.g. OpenSSL-based) for other algorithms"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}