mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
c712133df0
I've re-written the code for this several times before but always ended up not going through with it because a hashed Bcrypt string has dollar signs in it, which caused issues with the config due to environment variable support. I finally decided to go through with it by forcing users to base64 encode the bcrypt hash
15 lines
298 B
Go
15 lines
298 B
Go
package security
|
|
|
|
import (
|
|
"crypto/sha512"
|
|
"fmt"
|
|
)
|
|
|
|
// Sha512 hashes a provided string using SHA512 and returns the resulting hash as a string
|
|
// Deprecated: Use bcrypt instead
|
|
func Sha512(s string) string {
|
|
hash := sha512.New()
|
|
hash.Write([]byte(s))
|
|
return fmt.Sprintf("%x", hash.Sum(nil))
|
|
}
|