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 f7B      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 f8C      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 f9D      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 faE      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 fbF      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 fcG      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 fdH      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 feI      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 ffJ      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 00K      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 01L      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 02M      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 03N      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 04O      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 05P      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 06Q      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 07R      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 08S      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 09T      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 0aU      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 0bV      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 0cW      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 0dX      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 0eY      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 0fZ      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 10a      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 17b      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 18c      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 19d      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 1ae      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 1bf      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 1cg      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 1dh      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 1ei      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 1fj      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 20k      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 21l      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 22m      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 23n      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 24o      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 25p      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 26q      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 27r      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 28s      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 29t      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 2au      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 2bv      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 2cw      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 2dx      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 2ey      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 2fz      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 30Above 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 f7B     ...   3a c1   ...   99 60 0f f8C     ...   3a c3   ...   99 86 0f f9D     ...   ba c0   ...   99 ac 0f faE     ...   ba c2   ...   99 d2 0f fbF     ...   ba c1   ...   99 f8 0f fcG     ...   ba c3   ...   9a 1e 0f fdH     ...   7a c0   ...   9a 44 0f feI     ...   7a c2   ...   9a 6a 0f ffJ     ...   7a c1   ...   9a 90 10 00K     ...   7a c3   ...   9a b6 10 01L     ...   fa c0   ...   9a dc 10 02M     ...   fa c2   ...   9b 02 10 03N     ...   fa c1   ...   9b 28 10 04O     ...   fa c3   ...   9b 4e 10 05P     ...   06 c0   ...   9b 74 10 06Q     ...   06 c2   ...   9b 9a 10 07R     ...   06 c1   ...   9b c0 10 08S     ...   06 c3   ...   9b e6 10 09T     ...   86 c0   ...   9c 0c 10 0aU     ...   86 c2   ...   9c 32 10 0bV     ...   86 c1   ...   9c 58 10 0cW     ...   86 c3   ...   9c 7e 10 0dX     ...   46 c0   ...   9c a4 10 0eY     ...   46 c2   ...   9c ca 10 0fZ     ...   46 c1   ...   9c f0 10 10a     ...   26 c2   ...   9d fa 10 17b     ...   26 c1   ...   9e 20 10 18c     ...   26 c3   ...   9e 46 10 19d     ...   a6 c0   ...   9e 6c 10 1ae     ...   a6 c2   ...   9e 92 10 1bf     ...   a6 c1   ...   9e b8 10 1cg     ...   a6 c3   ...   9e de 10 1dh     ...   66 c0   ...   9f 04 10 1ei     ...   66 c2   ...   9f 2a 10 1fj     ...   66 c1   ...   9f 50 10 20k     ...   66 c3   ...   9f 76 10 21l     ...   e6 c0   ...   9f 9c 10 22m     ...   e6 c2   ...   9f c2 10 23n     ...   e6 c1   ...   9f e8 10 24o     ...   e6 c3   ...   a0 0e 10 25p     ...   16 c0   ...   a0 34 10 26q     ...   16 c2   ...   a0 5a 10 27r     ...   16 c1   ...   a0 80 10 28s     ...   16 c3   ...   a0 a6 10 29t     ...   96 c0   ...   a0 cc 10 2au     ...   96 c2   ...   a0 f2 10 2bv     ...   96 c1   ...   a1 18 10 2cw     ...   96 c3   ...   a1 3e 10 2dx     ...   56 c0   ...   a1 64 10 2ey     ...   56 c2   ...   a1 8a 10 2fz     ...   56 c1   ...   a1 b0 10 30Even 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 17B     ...   3a c1   ...   99 60 0f f8    |    b     ...   26 c1   ...   9e 20 10 18C     ...   3a c3   ...   99 86 0f f9    |    c     ...   26 c3   ...   9e 46 10 19D     ...   ba c0   ...   99 ac 0f fa    |    d     ...   a6 c0   ...   9e 6c 10 1aE     ...   ba c2   ...   99 d2 0f fb    |    e     ...   a6 c2   ...   9e 92 10 1bF     ...   ba c1   ...   99 f8 0f fc    |    f     ...   a6 c1   ...   9e b8 10 1cG     ...   ba c3   ...   9a 1e 0f fd    |    g     ...   a6 c3   ...   9e de 10 1dH     ...   7a c0   ...   9a 44 0f fe    |    h     ...   66 c0   ...   9f 04 10 1eI     ...   7a c2   ...   9a 6a 0f ff    |    i     ...   66 c2   ...   9f 2a 10 1fJ     ...   7a c1   ...   9a 90 10 00    |    j     ...   66 c1   ...   9f 50 10 20K     ...   7a c3   ...   9a b6 10 01    |    k     ...   66 c3   ...   9f 76 10 21L     ...   fa c0   ...   9a dc 10 02    |    l     ...   e6 c0   ...   9f 9c 10 22M     ...   fa c2   ...   9b 02 10 03    |    m     ...   e6 c2   ...   9f c2 10 23N     ...   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 25P     ...   06 c0   ...   9b 74 10 06    |    p     ...   16 c0   ...   a0 34 10 26Q     ...   06 c2   ...   9b 9a 10 07    |    q     ...   16 c2   ...   a0 5a 10 27R     ...   06 c1   ...   9b c0 10 08    |    r     ...   16 c1   ...   a0 80 10 28S     ...   06 c3   ...   9b e6 10 09    |    s     ...   16 c3   ...   a0 a6 10 29T     ...   86 c0   ...   9c 0c 10 0a    |    t     ...   96 c0   ...   a0 cc 10 2aU     ...   86 c2   ...   9c 32 10 0b    |    u     ...   96 c2   ...   a0 f2 10 2bV     ...   86 c1   ...   9c 58 10 0c    |    v     ...   96 c1   ...   a1 18 10 2cW     ...   86 c3   ...   9c 7e 10 0d    |    w     ...   96 c3   ...   a1 3e 10 2dX     ...   46 c0   ...   9c a4 10 0e    |    x     ...   56 c0   ...   a1 64 10 2eY     ...   46 c2   ...   9c ca 10 0f    |    y     ...   56 c2   ...   a1 8a 10 2fZ     ...   46 c1   ...   9c f0 10 10    |    z     ...   56 c1   ...   a1 b0 10 30Interestingly 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 17aa    ...   25 32 24 c2 95 02 f9 20 31   ...   c0 c5 10 79And 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.Can anyone suggest a better method of cracking this code?What data will I need to crack the code? Fortunately I can just mass produce this data... 
Decrypting/Decoding encrypted/encoded data
encryption;encodings;cryptography