summaryrefslogtreecommitdiffstats
path: root/utils/hash.go
blob: cc82fd94b112b1df1411ecc8b466745eaf10e309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

package utils

import (
	"crypto/sha256"
	"fmt"
)

func HashSha256(text string) string {
	hash := sha256.New()
	hash.Write([]byte(text))

	return fmt.Sprintf("%x", hash.Sum(nil))
}