diff --git a/payload.go b/payload.go index b52cf3b..30bd391 100644 --- a/payload.go +++ b/payload.go @@ -252,8 +252,9 @@ func (p *Payload) PackLittleEndian() *big.Int { // Reverse byte array for little endian signals. func reverse(data []byte) []byte { reversedArray := make([]byte, len(data)) - for i, j := 0, len(data)-1; i < j; i, j = i+1, j-1 { - reversedArray[i], reversedArray[j] = data[j], data[i] + copy(reversedArray, data) + for i, j := 0, len(reversedArray)-1; i < j; i, j = i+1, j-1 { + reversedArray[i], reversedArray[j] = reversedArray[j], reversedArray[i] } return reversedArray }