diff --git a/_pkg.dev/crypto/hash/hash.go b/pkg/crypto/hash/hash.go similarity index 97% rename from _pkg.dev/crypto/hash/hash.go rename to pkg/crypto/hash/hash.go index be7ab29b9..3b9197484 100755 --- a/_pkg.dev/crypto/hash/hash.go +++ b/pkg/crypto/hash/hash.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "io" - "github.com/CityOfZion/neo-go/pkg/wire/util" + "github.com/CityOfZion/neo-go/pkg/util" "golang.org/x/crypto/ripemd160" ) diff --git a/_pkg.dev/crypto/hash/hash_test.go b/pkg/crypto/hash/hash_test.go similarity index 91% rename from _pkg.dev/crypto/hash/hash_test.go rename to pkg/crypto/hash/hash_test.go index aa23718f6..b0ca0633f 100755 --- a/_pkg.dev/crypto/hash/hash_test.go +++ b/pkg/crypto/hash/hash_test.go @@ -15,7 +15,7 @@ func TestSha256(t *testing.T) { t.Fatal(err) } expected := "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824" - actual := hex.EncodeToString(data.Bytes()) // MARK: In the DecodeBytes function, there is a bytes reverse, not sure why? + actual := hex.EncodeToString(data.Bytes()) assert.Equal(t, expected, actual) } diff --git a/pkg/util/uint256.go b/pkg/util/uint256.go index 07eb73001..fbf9a41a1 100644 --- a/pkg/util/uint256.go +++ b/pkg/util/uint256.go @@ -25,9 +25,8 @@ func Uint256DecodeReverseString(s string) (u Uint256, err error) { return Uint256DecodeReverseBytes(b) } -// Uint256DecodeReverseBytes attempts to decode the given string (in LE representation) into an Uint256. -func Uint256DecodeReverseBytes(b []byte) (u Uint256, err error) { - b = ArrayReverse(b) +// Uint256DecodeBytes attempts to decode the given string (in BE representation) into an Uint256. +func Uint256DecodeBytes(b []byte) (u Uint256, err error) { if len(b) != uint256Size { return u, fmt.Errorf("expected []byte of size %d got %d", uint256Size, len(b)) } @@ -35,6 +34,12 @@ func Uint256DecodeReverseBytes(b []byte) (u Uint256, err error) { return u, nil } +// Uint256DecodeReverseBytes attempts to decode the given string (in LE representation) into an Uint256. +func Uint256DecodeReverseBytes(b []byte) (u Uint256, err error) { + b = ArrayReverse(b) + return Uint256DecodeBytes(b) +} + // Bytes returns a byte slice representation of u. func (u Uint256) Bytes() []byte { return u[:]