Golang Convert Byte Array To Hex String

[Solved] Golang Convert Byte Array To Hex String | Go - Code Explorer | yomemimo.com
Question : golang convert byte array to hex string

Answered by : dave-oukrqevg8554

import (	"fmt"	"crypto/sha1" "encoding/hex"
)
func MakeHash(val string) {	// val = foo	hash := sha1.New()	hash.Write([]byte(val)) hashstr := hex.EncodeToString(hash.Sum(nil)) fmt.Println(hashstr) // prints 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
}

Source : | Last Update : Thu, 19 May 22

Answers related to golang convert byte array to hex string

Code Explorer Popular Question For Go