{"record":{"id":"57d4a63e6b7ccc3f","repo":"beemdevelopment/Aegis","slug":"unsupported-hash-algorithm-d","errorCode":null,"errorMessage":"Unsupported hash algorithm: %d","messagePattern":"Unsupported hash algorithm: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java","lineNumber":235,"sourceCode":"                    default:\n                        throw new GoogleAuthInfoException(uri, String.format(\"Unsupported digits: %d\", params.getDigits().ordinal()));\n                }\n\n                String algo;\n                switch (params.getAlgorithm()) {\n                    case ALGORITHM_UNSPECIFIED:\n                        // intentional fallthrough\n                    case ALGORITHM_SHA1:\n                        algo = \"SHA1\";\n                        break;\n                    case ALGORITHM_SHA256:\n                        algo = \"SHA256\";\n                        break;\n                    case ALGORITHM_SHA512:\n                        algo = \"SHA512\";\n                        break;\n                    default:\n                        throw new GoogleAuthInfoException(uri, String.format(\"Unsupported hash algorithm: %d\", params.getAlgorithm().ordinal()));\n                }\n\n                byte[] secret = params.getSecret().toByteArray();\n                if (secret.length == 0) {\n                    throw new GoogleAuthInfoException(uri, \"Secret is empty\");\n                }\n\n                switch (params.getType()) {\n                    case OTP_TYPE_UNSPECIFIED:\n                        // intentional fallthrough\n                    case OTP_TYPE_TOTP:\n                        otp = new TotpInfo(secret, algo, digits, TotpInfo.DEFAULT_PERIOD);\n                        break;\n                    case OTP_TYPE_HOTP:\n                        otp = new HotpInfo(secret, algo, digits, params.getCounter());\n                        break;\n                    default:\n                        throw new GoogleAuthInfoException(uri, String.format(\"Unsupported algorithm: %d\", params.getType().ordinal()));","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java#L217-L253","documentation":"Each migration payload entry declares an HMAC algorithm enum. Aegis maps only SHA1 (default), SHA256, and SHA512; unspecified falls back to SHA1. Any other Algorithm enum value in the payload throws this GoogleAuthInfoException.","triggerScenarios":"Parsing a migration payload where params.getAlgorithm() is an enum value other than ALGORITHM_UNSPECIFIED, ALGORITHM_SHA1, ALGORITHM_SHA256, or ALGORITHM_SHA512, reaching the default branch of the algorithm switch.","commonSituations":"Exports from newer Authenticator versions that added a new algorithm enum, or programmatically generated protobuf payloads with invalid algorithm fields.","solutions":["Use a token configured with SHA1/SHA256/SHA512 before exporting","Regenerate the payload with a compatible exporter version","If producing payloads yourself, set Algorithm only to the supported enum values"],"exampleFix":"// before\nparameters.setAlgorithm(ALGORITHM_SHA3_512); // unsupported enum\n// after\nparameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_SHA512);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    GoogleAuthInfo.parseExportUri(uri);\n} catch (GoogleAuthInfoException e) {\n    Log.w(TAG, \"Token skipped: \" + e.getMessage());\n}","preventionTips":["Use SHA1/SHA256/SHA512 for tokens intended for export","Avoid exotic algorithms unsupported by the Google Authenticator format","Catch per-entry so one unsupported token doesn't fail the batch"],"tags":["otp","enum","hash-algorithm"],"backgroundTag":"unsupported-enum-value","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}