summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-12-06 16:12:54 -0500
committerrsiddharth <s@ricketyspace.net>2020-12-06 16:12:54 -0500
commitf59d9bf45554817d2a46c976616bdf034963d1e1 (patch)
tree7c437a6e5c4a52e6e0ce5c91e40747d7c41e9563
parenteaa49f9e6028c7cd87806967e034786d728561e8 (diff)
lib/hex: add PrettifyHexStr
-rw-r--r--lib/hex.go12
1 files changed, 12 insertions, 0 deletions
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
+}