aboutsummaryrefslogtreecommitdiffstats
path: root/util.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-01-09 06:43:20 +0800
committerobscuren <geffobscura@gmail.com>2014-01-09 06:43:20 +0800
commit92b6667bd1cf7aad4a00331d761d8a92b03a7cae (patch)
tree01eba885b03343e576785082d90e3f786cf48261 /util.go
parent9f42835a0204ba2508895c1d259340bcda843974 (diff)
downloadgo-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.tar
go-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.tar.gz
go-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.tar.bz2
go-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.tar.lz
go-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.tar.xz
go-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.tar.zst
go-tangerine-92b6667bd1cf7aad4a00331d761d8a92b03a7cae.zip
Minor update
Diffstat (limited to 'util.go')
-rw-r--r--util.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.go b/util.go
index 512a6f3d7..24e5455f4 100644
--- a/util.go
+++ b/util.go
@@ -6,6 +6,7 @@ import (
"encoding/hex"
_"fmt"
_"math"
+ "github.com/obscuren/sha3"
)
func Uitoa(i uint32) string {
@@ -24,6 +25,14 @@ func Sha256Bin(data []byte) []byte {
return hash[:]
}
+func Sha3Bin(data []byte) []byte {
+ d := sha3.NewKeccak224()
+ d.Reset()
+ d.Write(data)
+
+ return d.Sum(nil)
+}
+
// Helper function for comparing slices
func CompareIntSlice(a, b []int) bool {
if len(a) != len(b) {
@@ -48,3 +57,7 @@ func MatchingNibbleLength(a, b []int) int {
return i
}
+
+func Hex(d []byte) string {
+ return hex.EncodeToString(d)
+}