summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-10-10 09:44:17 -0400
committersiddharth <s@ricketyspace.net>2021-10-10 09:44:17 -0400
commit4f69c676b0da0b156cd0bf6255f39e704a2931cf (patch)
tree678470f7ba7078c60d565587acbc4602f9caf9df
parent76817030d36bcf4e446e404ac8147c4a7ecd6617 (diff)
lib: update HexStrToAsciiStr
Convert uint16 to byte before converting it to a string.
-rw-r--r--lib/hex.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/hex.go b/lib/hex.go
index f07ba08..ff5ee27 100644
--- a/lib/hex.go
+++ b/lib/hex.go
@@ -34,11 +34,11 @@ func HexStrToAsciiStr(h string) string {
return a
}
if lh == 1 {
- return string(HexCharToDec(h[0]))
+ return string(byte(HexCharToDec(h[0])))
}
for i := 0; i < lh; i += 2 {
- b := HexCharToDec(h[i])<<4 | HexCharToDec(h[i+1])
+ b := byte(HexCharToDec(h[i])<<4 | HexCharToDec(h[i+1]))
a += string(b)
}
return a