How secure is this use of Ziv-Lempel encoding? I'm reading patent application US 20120278897 A1 — “System and method of sort-order preserving tokenization”. Near the bottom they describe their token generation algorithm, which basically involves using the first few characters of a string as input to a modified order preserving Ziv-Lempel compression function described in this patent. They then prepend the output to the token and treat it as a kind of 'sort prefix' which can enable sorting. 

I would like to know what (if any) security can be guaranteed for the characters of the plaintext used to generate the 'sort prefix'. More generally, how difficult is it for an adversary to distinguish two strings which have been Ziv-Lempel encoded but not encrypted? 

The patent application makes this statement: 


  An attacker may still be able to determine the first character with some level of certainty, but since they would no longer have all of the characters encoded within the Ziv-Lempel tree, the token is no longer susceptible to a dictionary attack


Given enough samples of this compression function is it possible for an attacker to partially reconstruct the tree and guess the input for an arbitrary output value?
Ziv-Lempel is a data compression algorithm, so in general it doesn't protect your data. As for your question: 


  More generally, how difficult is it for an adversary to distinguish two strings which have been Ziv-Lempel encoded but not encrypted?


An adversary just can decode two strings and compare them. Due to the fact that Ziv-Lempel is an encoding algorithm, if you send your data to somebody then you have to send the other information needed to decode your data by the receiver. So, in this case an attacker can easily get access to the transmitted data.