From 10d5605166fd958f423cf69a6b2700a8b506a0ea Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 26 Aug 2019 14:27:00 +0300 Subject: [PATCH] _pkg.dev: drop Checksum package Duplicates hash.Checksum slightly and doesn't seem to fit into master well. --- _pkg.dev/wire/util/Checksum/checksum.go | 33 ------------------------- 1 file changed, 33 deletions(-) delete mode 100644 _pkg.dev/wire/util/Checksum/checksum.go diff --git a/_pkg.dev/wire/util/Checksum/checksum.go b/_pkg.dev/wire/util/Checksum/checksum.go deleted file mode 100644 index 6282650c7..000000000 --- a/_pkg.dev/wire/util/Checksum/checksum.go +++ /dev/null @@ -1,33 +0,0 @@ -package checksum - -import ( - "bytes" - "encoding/binary" - - "github.com/CityOfZion/neo-go/pkg/crypto/hash" -) - -// Compare calculates the checksum of b -// then compares it with the `have` checksum passed as a parameter -func Compare(have uint32, b []byte) bool { - want := FromBytes(b) - return have == want -} - -// FromBuf calculates the checksum of a buffer -func FromBuf(buf *bytes.Buffer) uint32 { - - return FromBytes(buf.Bytes()) -} - -// FromBytes calculates the checksum of a byte slice -func FromBytes(buf []byte) uint32 { - b, err := hash.DoubleSha256(buf) - - if err != nil { - return 0 - } - - // checksum := SumSHA256(SumSHA256(buf.Bytes())) - return binary.LittleEndian.Uint32(b.Bytes()[:4]) -}