aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/encoding.go
diff options
context:
space:
mode:
Diffstat (limited to 'ethutil/encoding.go')
-rw-r--r--ethutil/encoding.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/ethutil/encoding.go b/ethutil/encoding.go
index 1f661947a..9fcdf3edf 100644
--- a/ethutil/encoding.go
+++ b/ethutil/encoding.go
@@ -59,3 +59,18 @@ func CompactHexDecode(str string) []int {
return hexSlice
}
+
+func DecodeCompact(key []int) string {
+ base := "0123456789abcdef"
+ var str string
+
+ for _, v := range key {
+ if v < 16 {
+ str += string(base[v])
+ }
+ }
+
+ res, _ := hex.DecodeString(str)
+
+ return string(res)
+}