mirror of
https://github.com/stakater/Reloader.git
synced 2026-08-23 14:06:27 +00:00
15 lines
412 B
Go
15 lines
412 B
Go
package crypto
|
|
|
|
import (
|
|
"crypto/sha512"
|
|
"encoding/hex"
|
|
)
|
|
|
|
// GenerateSHA generates SHA from string
|
|
// Always returns a hash value, even for empty strings, to ensure consistent behavior
|
|
// and avoid issues with string matching operations (e.g., strings.Contains(str, "") always returns true)
|
|
func GenerateSHA(data string) string {
|
|
hash := sha512.Sum512_256([]byte(data))
|
|
return hex.EncodeToString(hash[:])
|
|
}
|