If it’s essential to SHA256 a String in Go, then you should use the crypto/sha256
package deal.
SHA256 a String in Go
package deal most important
import (
"crypto/sha256"
"fmt"
)
func most important() {
s := "A pattern string to SHA256!"
h := sha256.New()
h.Write([]byte(s))
bs := h.Sum(nil)
fmt.Println(s)
fmt.Printf("%xn", bs)
}
The output will seem like this:
A pattern string to SHA256!
9abf637c7e39cc4ef84d6d92cf7ffe168dc922b8ae666260d907e0353865ce89