From 92b6667bd1cf7aad4a00331d761d8a92b03a7cae Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 8 Jan 2014 23:43:20 +0100 Subject: Minor update --- util.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'util.go') 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) +} -- cgit v1.2.3