{"record":{"id":"da14bd6f156df552","repo":"shadow1ng/fscan","slug":"invalid-hash-length-s","errorCode":null,"errorMessage":"invalid hash length: %s","messagePattern":"invalid hash length: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/config_builder.go","lineNumber":213,"sourceCode":"\t\tpairs = append(pairs, filePairs...)\n\t}\n\n\treturn pairs, nil\n}\n\nfunc parseHashes(fv *FlagVars) ([]string, [][]byte, error) {\n\tvar hashValues []string\n\tvar hashBytes [][]byte\n\n\t// 命令行哈希（支持纯 NTLM 32字符 或 LM:NT 格式）\n\tif fv.HashValue != \"\" {\n\t\thash := strings.TrimSpace(fv.HashValue)\n\t\t// LM:NT 格式取 NT hash 部分\n\t\tif parts := strings.SplitN(hash, \":\", 2); len(parts) == 2 && len(parts[1]) == 32 {\n\t\t\thash = parts[1]\n\t\t}\n\t\tif len(hash) != 32 {\n\t\t\treturn nil, nil, fmt.Errorf(\"invalid hash length: %s\", fv.HashValue)\n\t\t}\n\t\thashByte, err := hex.DecodeString(hash)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\thashValues = append(hashValues, hash)\n\t\thashBytes = append(hashBytes, hashByte)\n\t}\n\n\t// 从文件读取\n\tif fv.HashFile != \"\" {\n\t\tfileHashes, fileHashBytes, err := parsers.ParseHashFile(fv.HashFile)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\thashValues = append(hashValues, fileHashes...)\n\t\thashBytes = append(hashBytes, fileHashBytes...)\n\t}","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/common/config_builder.go#L195-L231","documentation":"Validation failure in parseHashes while parsing the -hash command-line credential: after trimming (and extracting the NT part of an LM:NT pair when the NT side is 32 chars), the hash is not exactly 32 hex characters. The offending value is fv.HashValue; the error echoes the original raw input so the user can see what was rejected.","triggerScenarios":"Thrown at common/config_builder.go:213 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply the NT hash as exactly 32 hexadecimal characters","For LM:NT input ensure the NT portion after the colon is 32 chars","Re-extract the hash from the target (e.g. mimikatz/SAM dump) if truncated"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}