From f59d9bf45554817d2a46c976616bdf034963d1e1 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Sun, 6 Dec 2020 16:12:54 -0500 Subject: lib/hex: add PrettifyHexStr --- lib/hex.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/hex.go b/lib/hex.go index 9ec762c..f07ba08 100644 --- a/lib/hex.go +++ b/lib/hex.go @@ -94,3 +94,15 @@ func BytesToHexStr(bs []byte) string { } return hs } + +func PrettifyHexStr(hs string) string { + p_hs := "" + for i := 0; i < len(hs); i++ { + p_hs += string(hs[i]) + + if (i+1)%32 == 0 { + p_hs += "\n" + } + } + return p_hs +} -- cgit v1.2.3