feat: add new features such as database watchdog

This commit is contained in:
DaanSelen
2026-04-21 16:27:04 +02:00
parent 610fdffdb8
commit c4a4fafb52
16 changed files with 428 additions and 158 deletions
+27
View File
@@ -0,0 +1,27 @@
package crypto
import (
"crypto/sha512"
"encoding/hex"
"io"
"os"
)
func CalculateHash(p string) (string, error) {
f, err := os.Open(p)
if err != nil {
return "", err
}
defer f.Close()
h := sha512.New()
if _, err := io.Copy(h, f); err != nil {
return "", err
}
sum := h.Sum(nil)
// return the sha checksum in hex
return hex.EncodeToString(sum), nil
// alternatively return in base64
//return base64.StdEncoding.EncodeToString(sum), nil
}