diff options
author | obscuren <geffobscura@gmail.com> | 2014-01-09 06:43:20 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-01-09 06:43:20 +0800 |
commit | 92b6667bd1cf7aad4a00331d761d8a92b03a7cae (patch) | |
tree | 01eba885b03343e576785082d90e3f786cf48261 /util.go | |
parent | 9f42835a0204ba2508895c1d259340bcda843974 (diff) | |
download | go-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.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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) +} |