diff --git a/get.go b/get.go index c4526f9..2a13fd9 100644 --- a/get.go +++ b/get.go @@ -60,21 +60,12 @@ func GetQueryDigest(dataStream io.Reader) (digest string, err error) { return } - // turn the digestRaw into TWO uint32 // first we need to convert it back into []byte buf := make([]byte, 8) binary.LittleEndian.PutUint64(buf, digestRaw) - // then split it into two - b1 := buf[:4] - b2 := buf[4:] - - // then convert them into uint32 - d1 := binary.LittleEndian.Uint32(b1) - d2 := binary.LittleEndian.Uint32(b2) - // then turn into hex string - digest = fmt.Sprintf("0x%X%X", d1, d2) + digest = fmt.Sprintf("0x%X", buf) return } diff --git a/get_test.go b/get_test.go index 8060f0c..9ceffda 100644 --- a/get_test.go +++ b/get_test.go @@ -264,7 +264,7 @@ func TestGetQueryDigest(t *testing.T) { digestStr, err := GetQueryDigest(buf) require.NoError(t, err) - require.Equal(t, "0x14BA1FD6AE231F4D", digestStr) + require.Equal(t, "0xD61FBA144D1F23AE", digestStr) } func TestGetQueryDigestNegative(t *testing.T) { diff --git a/pxld_test.go b/pxld_test.go index 24e6440..e5c8978 100644 --- a/pxld_test.go +++ b/pxld_test.go @@ -42,7 +42,7 @@ var ( RawMessage: testData[8:], Username: "didasy", Schema: "test", - QueryDigest: "0xB3136F4238DF1D37", + QueryDigest: "0x426F13B3371DDF38", HID: 1, ClientAddr: "127.0.0.1:33680", ServerAddr: "127.0.0.1:3306", @@ -57,7 +57,7 @@ var ( "schema": "test", "start_at": "2019-04-10T15:08:00.727354+07:00", "end_at": "2019-04-10T15:08:00.727354+07:00", - "query_digest": "0xB3136F4238DF1D37", + "query_digest": "0x426F13B3371DDF38", "hid": 1, "client_addr": "127.0.0.1:33680", "server_addr": "127.0.0.1:3306",