diff --git a/pkg/io/crypto/hasher/hasher.go b/pkg/io/crypto/hasher/hasher.go index 811b0c3..550fab4 100644 --- a/pkg/io/crypto/hasher/hasher.go +++ b/pkg/io/crypto/hasher/hasher.go @@ -3,6 +3,7 @@ package hasher import ( "crypto/md5" "crypto/sha256" + "encoding/hex" "hash" "io" "os" @@ -38,7 +39,7 @@ func (self *Hasher) GetFileHashString(fileLocation string) (string, error) { return "", err } - return string(bytes), nil + return convertBytesToString(bytes), nil } func (self *Hasher) GetFileHashBytes(fileLocation string) ([]byte, error) { @@ -57,7 +58,7 @@ func (self *Hasher) GetHashString(reader io.Reader) (string, error) { return "", err } - return string(bytes), nil + return convertBytesToString(bytes), nil } func (self *Hasher) GetHashBytes(reader io.Reader) ([]byte, error) { @@ -70,3 +71,7 @@ func (self *Hasher) GetHashBytes(reader io.Reader) ([]byte, error) { return hasher.Sum(nil), nil } + +func convertBytesToString(bytes []byte) string { + return hex.EncodeToString(bytes) +}