mirror of
https://github.com/stakater/Reloader.git
synced 2026-02-14 18:09:50 +00:00
Readme update and change SHA1 to SHA512
Signed-off-by: faizanahmad055 <faizan.ahmad55@outlook.com>
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
package crypto
|
||||
|
||||
import (
|
||||
"crypto/sha1"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
"crypto/sha512"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
// 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)
|
||||
if data == "" {
|
||||
return ""
|
||||
}
|
||||
sha := hasher.Sum(nil)
|
||||
return fmt.Sprintf("%x", sha)
|
||||
|
||||
hash := sha512.Sum512_256([]byte(data))
|
||||
return hex.EncodeToString(hash[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user