mirror of
https://github.com/stakater/Reloader.git
synced 2026-02-14 18:09:50 +00:00
21 lines
369 B
Go
21 lines
369 B
Go
package crypto
|
|
|
|
import (
|
|
"crypto/sha1"
|
|
"fmt"
|
|
"io"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// GenerateSHA generates SHA from string
|
|
func GenerateSHA(data string) string {
|
|
hasher := sha1.New()
|
|
_, err := io.WriteString(hasher, data)
|
|
if err != nil {
|
|
logrus.Errorf("Unable to write data in hash writer %v", err)
|
|
}
|
|
sha := hasher.Sum(nil)
|
|
return fmt.Sprintf("%x", sha)
|
|
}
|