1

I'm trying to increase the interoperability of some database software. The database can write and read "stored SQL queries". I wanted to figure out the format of these SQL queries so I can build them outside the application.

I started out with some data gathering:

"A"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 3a c2 15 02 79 20 11 38 1f c6 60 04 32 00 99 3a 0f f7
"B"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 3a c1 15 02 79 20 11 38 1f c6 60 04 32 00 99 60 0f f8
"C"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 3a c3 15 02 79 20 11 38 1f c6 60 04 32 00 99 86 0f f9
"D"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 ba c0 15 02 79 20 11 38 1f c6 60 04 32 00 99 ac 0f fa
"E"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 ba c2 15 02 79 20 11 38 1f c6 60 04 32 00 99 d2 0f fb
"F"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 ba c1 15 02 79 20 11 38 1f c6 60 04 32 00 99 f8 0f fc
"G"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 ba c3 15 02 79 20 11 38 1f c6 60 04 32 00 9a 1e 0f fd
"H"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 7a c0 15 02 79 20 11 38 1f c6 60 04 32 00 9a 44 0f fe
"I"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 7a c2 15 02 79 20 11 38 1f c6 60 04 32 00 9a 6a 0f ff
"J"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 7a c1 15 02 79 20 11 38 1f c6 60 04 32 00 9a 90 10 00
"K"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 7a c3 15 02 79 20 11 38 1f c6 60 04 32 00 9a b6 10 01
"L"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 fa c0 15 02 79 20 11 38 1f c6 60 04 32 00 9a dc 10 02
"M"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 fa c2 15 02 79 20 11 38 1f c6 60 04 32 00 9b 02 10 03
"N"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 fa c1 15 02 79 20 11 38 1f c6 60 04 32 00 9b 28 10 04
"O"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 fa c3 15 02 79 20 11 38 1f c6 60 04 32 00 9b 4e 10 05
"P"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 06 c0 15 02 79 20 11 38 1f c6 60 04 32 00 9b 74 10 06
"Q"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 06 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9b 9a 10 07
"R"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 06 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9b c0 10 08
"S"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 06 c3 15 02 79 20 11 38 1f c6 60 04 32 00 9b e6 10 09
"T"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 86 c0 15 02 79 20 11 38 1f c6 60 04 32 00 9c 0c 10 0a
"U"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 86 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9c 32 10 0b
"V"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 86 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9c 58 10 0c
"W"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 86 c3 15 02 79 20 11 38 1f c6 60 04 32 00 9c 7e 10 0d
"X"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 46 c0 15 02 79 20 11 38 1f c6 60 04 32 00 9c a4 10 0e
"Y"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 46 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9c ca 10 0f
"Z"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 46 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9c f0 10 10
"a"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 26 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9d fa 10 17
"b"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 26 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9e 20 10 18
"c"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 26 c3 15 02 79 20 11 38 1f c6 60 04 32 00 9e 46 10 19
"d"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 a6 c0 15 02 79 20 11 38 1f c6 60 04 32 00 9e 6c 10 1a
"e"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 a6 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9e 92 10 1b
"f"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 a6 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9e b8 10 1c
"g"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 a6 c3 15 02 79 20 11 38 1f c6 60 04 32 00 9e de 10 1d
"h"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 66 c0 15 02 79 20 11 38 1f c6 60 04 32 00 9f 04 10 1e
"i"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 66 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9f 2a 10 1f
"j"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 66 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9f 50 10 20
"k"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 66 c3 15 02 79 20 11 38 1f c6 60 04 32 00 9f 76 10 21
"l"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 e6 c0 15 02 79 20 11 38 1f c6 60 04 32 00 9f 9c 10 22
"m"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 e6 c2 15 02 79 20 11 38 1f c6 60 04 32 00 9f c2 10 23
"n"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 e6 c1 15 02 79 20 11 38 1f c6 60 04 32 00 9f e8 10 24
"o"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 e6 c3 15 02 79 20 11 38 1f c6 60 04 32 00 a0 0e 10 25
"p"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 16 c0 15 02 79 20 11 38 1f c6 60 04 32 00 a0 34 10 26
"q"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 16 c2 15 02 79 20 11 38 1f c6 60 04 32 00 a0 5a 10 27
"r"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 16 c1 15 02 79 20 11 38 1f c6 60 04 32 00 a0 80 10 28
"s"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 16 c3 15 02 79 20 11 38 1f c6 60 04 32 00 a0 a6 10 29
"t"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 96 c0 15 02 79 20 11 38 1f c6 60 04 32 00 a0 cc 10 2a
"u"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 96 c2 15 02 79 20 11 38 1f c6 60 04 32 00 a0 f2 10 2b
"v"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 96 c1 15 02 79 20 11 38 1f c6 60 04 32 00 a1 18 10 2c
"w"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 96 c3 15 02 79 20 11 38 1f c6 60 04 32 00 a1 3e 10 2d
"x"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 56 c0 15 02 79 20 11 38 1f c6 60 04 32 00 a1 64 10 2e
"y"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 56 c2 15 02 79 20 11 38 1f c6 60 04 32 00 a1 8a 10 2f
"z"      ff aa 01 01 50 00 00 00 78 01 63 64 40 05 ff ff fd e7 4c 64 c8 01 c2 78 20 ce 64 c8 63 c8 66 28 66 00 8a 32 56 c1 15 02 79 20 11 38 1f c6 60 04 32 00 a1 b0 10 30

Above we have the quoted-contents of the stored query (left) and the BLOB data converted to hex (right).

Most of the contents is unaltered, so let's start by trimming the strings down to strictly the bytes that change:

"A"     ...   3a c2   ...   99 3a 0f f7
"B"     ...   3a c1   ...   99 60 0f f8
"C"     ...   3a c3   ...   99 86 0f f9
"D"     ...   ba c0   ...   99 ac 0f fa
"E"     ...   ba c2   ...   99 d2 0f fb
"F"     ...   ba c1   ...   99 f8 0f fc
"G"     ...   ba c3   ...   9a 1e 0f fd
"H"     ...   7a c0   ...   9a 44 0f fe
"I"     ...   7a c2   ...   9a 6a 0f ff
"J"     ...   7a c1   ...   9a 90 10 00
"K"     ...   7a c3   ...   9a b6 10 01
"L"     ...   fa c0   ...   9a dc 10 02
"M"     ...   fa c2   ...   9b 02 10 03
"N"     ...   fa c1   ...   9b 28 10 04
"O"     ...   fa c3   ...   9b 4e 10 05
"P"     ...   06 c0   ...   9b 74 10 06
"Q"     ...   06 c2   ...   9b 9a 10 07
"R"     ...   06 c1   ...   9b c0 10 08
"S"     ...   06 c3   ...   9b e6 10 09
"T"     ...   86 c0   ...   9c 0c 10 0a
"U"     ...   86 c2   ...   9c 32 10 0b
"V"     ...   86 c1   ...   9c 58 10 0c
"W"     ...   86 c3   ...   9c 7e 10 0d
"X"     ...   46 c0   ...   9c a4 10 0e
"Y"     ...   46 c2   ...   9c ca 10 0f
"Z"     ...   46 c1   ...   9c f0 10 10
"a"     ...   26 c2   ...   9d fa 10 17
"b"     ...   26 c1   ...   9e 20 10 18
"c"     ...   26 c3   ...   9e 46 10 19
"d"     ...   a6 c0   ...   9e 6c 10 1a
"e"     ...   a6 c2   ...   9e 92 10 1b
"f"     ...   a6 c1   ...   9e b8 10 1c
"g"     ...   a6 c3   ...   9e de 10 1d
"h"     ...   66 c0   ...   9f 04 10 1e
"i"     ...   66 c2   ...   9f 2a 10 1f
"j"     ...   66 c1   ...   9f 50 10 20
"k"     ...   66 c3   ...   9f 76 10 21
"l"     ...   e6 c0   ...   9f 9c 10 22
"m"     ...   e6 c2   ...   9f c2 10 23
"n"     ...   e6 c1   ...   9f e8 10 24
"o"     ...   e6 c3   ...   a0 0e 10 25
"p"     ...   16 c0   ...   a0 34 10 26
"q"     ...   16 c2   ...   a0 5a 10 27
"r"     ...   16 c1   ...   a0 80 10 28
"s"     ...   16 c3   ...   a0 a6 10 29
"t"     ...   96 c0   ...   a0 cc 10 2a
"u"     ...   96 c2   ...   a0 f2 10 2b
"v"     ...   96 c1   ...   a1 18 10 2c
"w"     ...   96 c3   ...   a1 3e 10 2d
"x"     ...   56 c0   ...   a1 64 10 2e
"y"     ...   56 c2   ...   a1 8a 10 2f
"z"     ...   56 c1   ...   a1 b0 10 30

Even though this is a fairly large sample of characters (though of course not all 256 ASCII characters) I can't really see a pattern between any of the rows.

Another way to look at the data:

"A"     ...   3a c2   ...   99 3a 0f f7    |    "a"     ...   26 c2   ...   9d fa 10 17
"B"     ...   3a c1   ...   99 60 0f f8    |    "b"     ...   26 c1   ...   9e 20 10 18
"C"     ...   3a c3   ...   99 86 0f f9    |    "c"     ...   26 c3   ...   9e 46 10 19
"D"     ...   ba c0   ...   99 ac 0f fa    |    "d"     ...   a6 c0   ...   9e 6c 10 1a
"E"     ...   ba c2   ...   99 d2 0f fb    |    "e"     ...   a6 c2   ...   9e 92 10 1b
"F"     ...   ba c1   ...   99 f8 0f fc    |    "f"     ...   a6 c1   ...   9e b8 10 1c
"G"     ...   ba c3   ...   9a 1e 0f fd    |    "g"     ...   a6 c3   ...   9e de 10 1d
"H"     ...   7a c0   ...   9a 44 0f fe    |    "h"     ...   66 c0   ...   9f 04 10 1e
"I"     ...   7a c2   ...   9a 6a 0f ff    |    "i"     ...   66 c2   ...   9f 2a 10 1f
"J"     ...   7a c1   ...   9a 90 10 00    |    "j"     ...   66 c1   ...   9f 50 10 20
"K"     ...   7a c3   ...   9a b6 10 01    |    "k"     ...   66 c3   ...   9f 76 10 21
"L"     ...   fa c0   ...   9a dc 10 02    |    "l"     ...   e6 c0   ...   9f 9c 10 22
"M"     ...   fa c2   ...   9b 02 10 03    |    "m"     ...   e6 c2   ...   9f c2 10 23
"N"     ...   fa c1   ...   9b 28 10 04    |    "n"     ...   e6 c1   ...   9f e8 10 24   
"O"     ...   fa c3   ...   9b 4e 10 05    |    "o"     ...   e6 c3   ...   a0 0e 10 25
"P"     ...   06 c0   ...   9b 74 10 06    |    "p"     ...   16 c0   ...   a0 34 10 26
"Q"     ...   06 c2   ...   9b 9a 10 07    |    "q"     ...   16 c2   ...   a0 5a 10 27
"R"     ...   06 c1   ...   9b c0 10 08    |    "r"     ...   16 c1   ...   a0 80 10 28
"S"     ...   06 c3   ...   9b e6 10 09    |    "s"     ...   16 c3   ...   a0 a6 10 29
"T"     ...   86 c0   ...   9c 0c 10 0a    |    "t"     ...   96 c0   ...   a0 cc 10 2a
"U"     ...   86 c2   ...   9c 32 10 0b    |    "u"     ...   96 c2   ...   a0 f2 10 2b
"V"     ...   86 c1   ...   9c 58 10 0c    |    "v"     ...   96 c1   ...   a1 18 10 2c
"W"     ...   86 c3   ...   9c 7e 10 0d    |    "w"     ...   96 c3   ...   a1 3e 10 2d
"X"     ...   46 c0   ...   9c a4 10 0e    |    "x"     ...   56 c0   ...   a1 64 10 2e
"Y"     ...   46 c2   ...   9c ca 10 0f    |    "y"     ...   56 c2   ...   a1 8a 10 2f
"Z"     ...   46 c1   ...   9c f0 10 10    |    "z"     ...   56 c1   ...   a1 b0 10 30

Interestingly the 2nd byte of the first altering section appears to be consistent across all A-Z and a-z. The 1st byte however only shares a moderate pattern though P-Z and p-z.

The final altering sections seem almost like completely arbitrary characters. Perhaps one part is a key and the other part is an encoded/encrypted character?

I also briefly took a look at the following:

"a"     ...   26 c2 15 02 79 20 11         ...   9d fa 10 17
"aa"    ...   25 32 24 c2 95 02 f9 20 31   ...   c0 c5 10 79

And that's where I stopped researching... I am yet to spot the pattern which links all this data together. I can't help but feel there is an easier way to solve this mystery but I currently just lack the knowledge to obtain the answer.

  1. Can anyone suggest a better method of cracking this code?
  2. What data will I need to crack the code? Fortunately I can just mass produce this data...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.