Skip to content

Commit

Permalink
HashToHexString
Browse files Browse the repository at this point in the history
  • Loading branch information
David Julien authored and David Julien committed Jun 13, 2017
1 parent 3ff4c9c commit 9673713
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions blockchain/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,12 @@ func HexStringToHash(s string) Hash {

return hash
}

// HashToHexString converts a hash to a hex string
func HashToHexString(h Hash) string {
var hash Hash
for i := 0; i < HashLen; i++ {
hash[i] = h[HashLen-1-i]
}
return hex.EncodeToString(hash[:])
}

0 comments on commit 9673713

Please sign in to comment.