fix: jobs

This commit is contained in:
Rogee
2025-01-16 15:59:21 +08:00
parent 2cd7f2a2b8
commit 3a8bb03cb7
12 changed files with 619 additions and 12 deletions

28
backend/pkg/utils/md5.go Normal file
View File

@@ -0,0 +1,28 @@
package utils
import (
"crypto/md5"
"encoding/hex"
"io"
"os"
)
// FileMd5 calculates the md5 of a file
func FileMd5(file string) (string, error) {
f, err := os.Open(file)
if err != nil {
return "", err
}
h := md5.New()
if _, err := io.Copy(h, f); err != nil {
return "", err
}
return hex.EncodeToString(h.Sum(nil)), nil
}
func StringMd5(s string) string {
h := md5.New()
h.Write([]byte(s))
return hex.EncodeToString(h.Sum(nil))
}