{"record":{"id":"39b7727bc6f6ce1c","repo":"qax-os/excelize","slug":"errunsupportedhashalgorithm","errorCode":"ErrUnsupportedHashAlgorithm","errorMessage":"unsupported hash algorithm","messagePattern":"unsupported hash algorithm","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"errors.go","lineNumber":197,"sourceCode":"\tErrUnknownEncryptMechanism = errors.New(\"unknown encryption mechanism\")\n\t// ErrUnprotectSheet defined the error message on worksheet has set no\n\t// protection.\n\tErrUnprotectSheet = errors.New(\"worksheet has set no protect\")\n\t// ErrUnprotectSheetPassword defined the error message on remove sheet\n\t// protection with password verification failed.\n\tErrUnprotectSheetPassword = errors.New(\"worksheet protect password not match\")\n\t// ErrUnprotectWorkbook defined the error message on workbook has set no\n\t// protection.\n\tErrUnprotectWorkbook = errors.New(\"workbook has set no protect\")\n\t// ErrUnprotectWorkbookPassword defined the error message on remove workbook\n\t// protection with password verification failed.\n\tErrUnprotectWorkbookPassword = errors.New(\"workbook protect password not match\")\n\t// ErrUnsupportedEncryptMechanism defined the error message on unsupported\n\t// encryption mechanism.\n\tErrUnsupportedEncryptMechanism = errors.New(\"unsupported encryption mechanism\")\n\t// ErrUnsupportedHashAlgorithm defined the error message on unsupported\n\t// hash algorithm.\n\tErrUnsupportedHashAlgorithm = errors.New(\"unsupported hash algorithm\")\n\t// ErrUnsupportedNumberFormat defined the error message on unsupported\n\t// number format expression.\n\tErrUnsupportedNumberFormat = errors.New(\"unsupported number format token\")\n\t// ErrUnsupportedPivotTableShowValuesAsType defined the error message on\n\t// receiving the unsupported pivot table \"show values as\" type.\n\tErrUnsupportedPivotTableShowValuesAsType = errors.New(\"unsupported pivot table show values as type\")\n\t// ErrWorkbookFileFormat defined the error message on receive an\n\t// unsupported workbook file format.\n\tErrWorkbookFileFormat = errors.New(\"unsupported workbook file format\")\n\t// ErrWorkbookPassword defined the error message on receiving the incorrect\n\t// workbook password.\n\tErrWorkbookPassword = errors.New(\"the supplied open workbook password is not correct\")\n)\n\n// ErrSheetNotExist defined an error of sheet that does not exist.\ntype ErrSheetNotExist struct {\n\tSheetName string\n}","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/qax-os/excelize/blob/f2483381fbfbe432a6baa98d48a1c277183f3285/errors.go#L179-L215","documentation":"ErrUnsupportedHashAlgorithm indicates that the hash algorithm name supplied in sheet or workbook protection options is not among the algorithms excelize can compute (map lookup in genISOPasswdHash fails at crypt.go:610).","triggerScenarios":"Calling f.ProtectSheet(sheet, &SheetProtectionOptions{AlgorithmName: \"RIPEMD-160\", ...}) or ProtectWorkbook with an AlgorithmName outside the supported set (e.g. RIPEMD-160).","commonSituations":"Copying AlgorithmName strings from other libraries or Excel XML that uses algorithms excelize does not implement; typo in algorithm name.","solutions":["Use a supported AlgorithmName such as \"SHA-512\", \"SHA-384\", \"SHA-256\", or \"MD5\"","Remove AlgorithmName to use the library default","Check the excelize docs/source map at crypt.go for the exact supported names"],"exampleFix":"// before\nf.ProtectSheet(\"Sheet1\", &SheetProtectionOptions{AlgorithmName: \"RIPEMD-160\", Password: \"password\"})\n// after\nf.ProtectSheet(\"Sheet1\", &SheetProtectionOptions{AlgorithmName: \"SHA-512\", Password: \"password\"})","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"MD5\": true, \"SHA-256\": true, \"SHA-384\": true, \"SHA-512\": true}\nif opts.AlgorithmName != \"\" && !supported[opts.AlgorithmName] {\n\treturn fmt.Errorf(\"algorithm %s not supported\", opts.AlgorithmName)\n}","typeGuard":null,"tryCatchPattern":"err := f.ProtectSheet(\"Sheet1\", opts)\nif errors.Is(err, excelize.ErrUnsupportedHashAlgorithm) {\n\treturn fmt.Errorf(\"use one of MD5/SHA-256/SHA-384/SHA-512\")\n}","preventionTips":["Use documented AlgorithmName values only","Leave AlgorithmName empty to use the library default","Centralize protection option construction in one helper"],"tags":["go","excelize","hash-algorithm","protection"],"backgroundTag":"unsupported-hash-algorithm","analyzedSha":"f2483381fbfbe432a6baa98d48a1c277183f3285","analyzedAt":"2026-09-02T01:26:19.299Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}