initial commit

This commit is contained in:
maurice fletgen
2022-09-08 09:18:04 +02:00
commit 447b2fb51d
163 changed files with 47569 additions and 0 deletions

24
pkg/security/crypto.go Normal file
View File

@@ -0,0 +1,24 @@
package security
import (
"crypto/sha256"
"encoding/hex"
"log"
"os"
)
// NewSHA256 ...
func NewSHA256(data []byte) []byte {
if os.Getenv("SALT") == "" {
log.Fatal("CRITICAL ERROR SALT was found to be empty")
}
prep := []byte(os.Getenv("SALT") + "-")
prep = append(prep, data...)
hash := sha256.Sum256(prep)
return hash[:]
}
func NewSHA256asString(data []byte) string {
return hex.EncodeToString(NewSHA256(data))
}