qax-os/excelize · error
ErrUnsupportedHashAlgorithm
ErrUnsupportedHashAlgorithm
Error message
unsupported hash algorithm
What it means
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).
Source
Thrown at errors.go:197
ErrUnknownEncryptMechanism = errors.New("unknown encryption mechanism")
// ErrUnprotectSheet defined the error message on worksheet has set no
// protection.
ErrUnprotectSheet = errors.New("worksheet has set no protect")
// ErrUnprotectSheetPassword defined the error message on remove sheet
// protection with password verification failed.
ErrUnprotectSheetPassword = errors.New("worksheet protect password not match")
// ErrUnprotectWorkbook defined the error message on workbook has set no
// protection.
ErrUnprotectWorkbook = errors.New("workbook has set no protect")
// ErrUnprotectWorkbookPassword defined the error message on remove workbook
// protection with password verification failed.
ErrUnprotectWorkbookPassword = errors.New("workbook protect password not match")
// ErrUnsupportedEncryptMechanism defined the error message on unsupported
// encryption mechanism.
ErrUnsupportedEncryptMechanism = errors.New("unsupported encryption mechanism")
// ErrUnsupportedHashAlgorithm defined the error message on unsupported
// hash algorithm.
ErrUnsupportedHashAlgorithm = errors.New("unsupported hash algorithm")
// ErrUnsupportedNumberFormat defined the error message on unsupported
// number format expression.
ErrUnsupportedNumberFormat = errors.New("unsupported number format token")
// ErrUnsupportedPivotTableShowValuesAsType defined the error message on
// receiving the unsupported pivot table "show values as" type.
ErrUnsupportedPivotTableShowValuesAsType = errors.New("unsupported pivot table show values as type")
// ErrWorkbookFileFormat defined the error message on receive an
// unsupported workbook file format.
ErrWorkbookFileFormat = errors.New("unsupported workbook file format")
// ErrWorkbookPassword defined the error message on receiving the incorrect
// workbook password.
ErrWorkbookPassword = errors.New("the supplied open workbook password is not correct")
)
// ErrSheetNotExist defined an error of sheet that does not exist.
type ErrSheetNotExist struct {
SheetName string
}View on GitHub (pinned to f2483381fb)
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
Example fix
// before
f.ProtectSheet("Sheet1", &SheetProtectionOptions{AlgorithmName: "RIPEMD-160", Password: "password"})
// after
f.ProtectSheet("Sheet1", &SheetProtectionOptions{AlgorithmName: "SHA-512", Password: "password"}) Defensive patterns
Strategy: validation
Validate before calling
supported := map[string]bool{"MD5": true, "SHA-256": true, "SHA-384": true, "SHA-512": true}
if opts.AlgorithmName != "" && !supported[opts.AlgorithmName] {
return fmt.Errorf("algorithm %s not supported", opts.AlgorithmName)
} Try / catch
err := f.ProtectSheet("Sheet1", opts)
if errors.Is(err, excelize.ErrUnsupportedHashAlgorithm) {
return fmt.Errorf("use one of MD5/SHA-256/SHA-384/SHA-512")
} Prevention
- Use documented AlgorithmName values only
- Leave AlgorithmName empty to use the library default
- Centralize protection option construction in one helper
When it happens
Trigger: Calling f.ProtectSheet(sheet, &SheetProtectionOptions{AlgorithmName: "RIPEMD-160", ...}) or ProtectWorkbook with an AlgorithmName outside the supported set (e.g. RIPEMD-160).
Common situations: Copying AlgorithmName strings from other libraries or Excel XML that uses algorithms excelize does not implement; typo in algorithm name.
Related errors
- fill type value must be one of 'gradient' or 'pattern'
- fill color value must be an array of two colors for 'gradien
- fill shading value must be between 0 and 16 for 'gradient' t
- fill color value must be empty or an array of one color for
- fill pattern value must be between 0 and 18
AI-assisted analysis of qax-os/excelize@f2483381fb (2026-09-02).
Data as JSON: /api/errors/39b7727bc6f6ce1c.
Report an issue: GitHub.