diff --git a/go.mod b/go.mod index 501850b..a1caa12 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/frankurcrazy/snow3g +module github.com/pedroalbanese/snow3g go 1.13 diff --git a/uea2/uea2.go b/uea2/uea2.go index 7f35ee8..fdad2f1 100644 --- a/uea2/uea2.go +++ b/uea2/uea2.go @@ -5,7 +5,7 @@ package uea2 import ( - "github.com/frankurcrazy/snow3g" + "github.com/pedroalbanese/snow3g" ) type UEA2 struct { diff --git a/uea2/uea2_test.go b/uea2/uea2_test.go index db0b91e..cdcd597 100644 --- a/uea2/uea2_test.go +++ b/uea2/uea2_test.go @@ -3,7 +3,7 @@ package uea2 import ( "encoding/binary" "encoding/hex" - "github.com/frankurcrazy/snow3g" + "github.com/pedroalbanese/snow3g" "github.com/stretchr/testify/assert" "strings" "testing" diff --git a/uia2/uia2.go b/uia2/uia2.go index 90b9477..e98c683 100644 --- a/uia2/uia2.go +++ b/uia2/uia2.go @@ -5,7 +5,8 @@ package uia2 import ( - "github.com/frankurcrazy/snow3g" + "bytes" + "github.com/pedroalbanese/snow3g" ) type UIA2 struct { @@ -95,3 +96,9 @@ func (u *UIA2) F9(data []byte, blength uint64) []byte { func (u *UIA2) Hash(data []byte, blength uint64) []byte { return u.F9(data, blength) } + +func (e *UIA2) Verify(m []byte, blen uint64, mac []byte) bool { + chksum := e.Hash(m, blen) + + return bytes.Compare(chksum, mac) == 0 +} diff --git a/uia2/uia2_test.go b/uia2/uia2_test.go index e0ca962..90c6d94 100644 --- a/uia2/uia2_test.go +++ b/uia2/uia2_test.go @@ -3,7 +3,7 @@ package uia2 import ( "encoding/binary" "encoding/hex" - "github.com/frankurcrazy/snow3g" + "github.com/pedroalbanese/snow3g" "github.com/stretchr/testify/assert" "strings" "testing"