Minor update

This commit is contained in:
obscuren
2014-01-08 23:43:20 +01:00
parent 9f42835a02
commit 92b6667bd1
7 changed files with 126 additions and 44 deletions

13
util.go
View File

@ -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)
}