create file into db

This commit is contained in:
m
2026-07-12 09:15:06 +02:00
parent ab3957040d
commit c2e0c9fce4
9 changed files with 122 additions and 37 deletions
+22
View File
@@ -0,0 +1,22 @@
package service
import (
"crypto/sha256"
"crypto/subtle"
)
func CreateSHA256Hash(data []byte) []byte {
hasher := sha256.New()
hasher.Write(data)
return hasher.Sum(nil)
}
func CompareHash(x, y []byte) bool {
if len(x) != len(y) {
return false
}
return subtle.ConstantTimeCompare(x, y) == 1
}