package fileUtilities import ( "crypto/sha256" "fmt" "io" "os" ) func HashFile(filePath string) ([]byte, error) { file, err := os.Open(filePath) if err != nil { return []byte{}, fmt.Errorf("error opening file for hashing: %w", err) } defer file.Close() h := sha256.New() if _, err := io.Copy(h, file); err != nil { return []byte{}, fmt.Errorf("error hashing file: %w", err) } return h.Sum(nil), nil }