calculateFileHash 计算文件内容的SHA256哈希
(fileContent []byte)
| 137 | |
| 138 | // calculateFileHash 计算文件内容的SHA256哈希 |
| 139 | func calculateFileHash(fileContent []byte) string { |
| 140 | hash := sha256.New() |
| 141 | hash.Write(fileContent) |
| 142 | hashInBytes := hash.Sum(nil) |
| 143 | return hex.EncodeToString(hashInBytes) |
| 144 | } |
| 145 | |
| 146 | // generateUniqueFileName 生成唯一的文件名,如果重复则添加序号 |
| 147 | func generateUniqueFileName(eid, libraryID int64, dirPath, fileName, extension string, excludeFileID int64) string { |
no test coverage detected