diff options
author | rsiddharth <s@ricketyspace.net> | 2020-12-06 16:12:54 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-12-06 16:12:54 -0500 |
commit | f59d9bf45554817d2a46c976616bdf034963d1e1 (patch) | |
tree | 7c437a6e5c4a52e6e0ce5c91e40747d7c41e9563 | |
parent | eaa49f9e6028c7cd87806967e034786d728561e8 (diff) |
lib/hex: add PrettifyHexStr
-rw-r--r-- | lib/hex.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 +} |