2020-10-14 19:24:00 -04:00
|
|
|
package security
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"crypto/sha512"
|
|
|
|
|
"fmt"
|
|
|
|
|
)
|
|
|
|
|
|
2020-10-23 15:58:59 -04:00
|
|
|
// Sha512 hashes a provided string using SHA512 and returns the resulting hash as a string
|
2020-10-14 19:24:00 -04:00
|
|
|
func Sha512(s string) string {
|
|
|
|
|
hash := sha512.New()
|
|
|
|
|
hash.Write([]byte(s))
|
|
|
|
|
return fmt.Sprintf("%x", hash.Sum(nil))
|
|
|
|
|
}
|