mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
14 lines
299 B
Go
14 lines
299 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"crypto/sha256"
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
// HashSHA256FromString takes an input string and calculates the SHA256 checksum returning it as a base16 hash string.
|
||
|
func HashSHA256FromString(input string) (output string) {
|
||
|
sum := sha256.Sum256([]byte(input))
|
||
|
|
||
|
return fmt.Sprintf("%x", sum)
|
||
|
}
|